Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js

Issue 2902913002: Roll Polymer to 1.9.1. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 (function () { 1 (function () {
2 Polymer.nar = []; 2 Polymer.nar = [];
3 var disableUpgradeEnabled = Polymer.Settings.disableUpgradeEnabled; 3 var disableUpgradeEnabled = Polymer.Settings.disableUpgradeEnabled;
4 Polymer.Annotations = { 4 Polymer.Annotations = {
5 parseAnnotations: function (template, stripWhiteSpace) { 5 parseAnnotations: function (template, stripWhiteSpace) {
6 var list = []; 6 var list = [];
7 var content = template._content || template.content; 7 var content = template._content || template.content;
8 this._parseNodeAnnotations(content, list, stripWhiteSpace || template.hasAttribu te('strip-whitespace')); 8 this._parseNodeAnnotations(content, list, stripWhiteSpace || template.hasAttribu te('strip-whitespace'));
9 return list; 9 return list;
10 }, 10 },
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) { 234 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) {
235 if (annote.index === i++) { 235 if (annote.index === i++) {
236 return n; 236 return n;
237 } 237 }
238 } 238 }
239 } else { 239 } else {
240 return root; 240 return root;
241 } 241 }
242 } 242 }
243 }; 243 };
244 }());(function () {
245 function resolveCss(cssText, ownerDocument) {
246 return cssText.replace(CSS_URL_RX, function (m, pre, url, post) {
247 return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + po st;
248 });
249 }
250 function resolveAttrs(element, ownerDocument) {
251 for (var name in URL_ATTRS) {
252 var a$ = URL_ATTRS[name];
253 for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) {
254 if (name === '*' || element.localName === name) {
255 at = element.attributes[a];
256 v = at && at.value;
257 if (v && v.search(BINDING_RX) < 0) {
258 at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocume nt);
259 }
260 }
261 }
262 }
263 }
264 function resolve(url, ownerDocument) {
265 if (url && ABS_URL.test(url)) {
266 return url;
267 }
268 var resolver = getUrlResolver(ownerDocument);
269 resolver.href = url;
270 return resolver.href || url;
271 }
272 var tempDoc;
273 var tempDocBase;
274 function resolveUrl(url, baseUri) {
275 if (!tempDoc) {
276 tempDoc = document.implementation.createHTMLDocument('temp');
277 tempDocBase = tempDoc.createElement('base');
278 tempDoc.head.appendChild(tempDocBase);
279 }
280 tempDocBase.href = baseUri;
281 return resolve(url, tempDoc);
282 }
283 function getUrlResolver(ownerDocument) {
284 return ownerDocument.body.__urlResolver || (ownerDocument.body.__urlResolver = o wnerDocument.createElement('a'));
285 }
286 var CSS_URL_RX = /(url\()([^)]*)(\))/g;
287 var URL_ATTRS = {
288 '*': [
289 'href',
290 'src',
291 'style',
292 'url'
293 ],
294 form: ['action']
295 };
296 var ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
297 var BINDING_RX = /\{\{|\[\[/;
298 Polymer.ResolveUrl = {
299 resolveCss: resolveCss,
300 resolveAttrs: resolveAttrs,
301 resolveUrl: resolveUrl
302 };
303 }());Polymer.Path = { 244 }());Polymer.Path = {
304 root: function (path) { 245 root: function (path) {
305 var dotIndex = path.indexOf('.'); 246 var dotIndex = path.indexOf('.');
306 if (dotIndex === -1) { 247 if (dotIndex === -1) {
307 return path; 248 return path;
308 } 249 }
309 return path.slice(0, dotIndex); 250 return path.slice(0, dotIndex);
310 }, 251 },
311 isDeep: function (path) { 252 isDeep: function (path) {
312 return path.indexOf('.') !== -1; 253 return path.indexOf('.') !== -1;
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 } 2019 }
2079 node._configValue(name, value); 2020 node._configValue(name, value);
2080 } 2021 }
2081 } 2022 }
2082 } 2023 }
2083 } 2024 }
2084 } 2025 }
2085 } 2026 }
2086 }, 2027 },
2087 _afterClientsReady: function () { 2028 _afterClientsReady: function () {
2029 this.importPath = this._importPath;
2030 this.rootPath = Polymer.rootPath;
2088 this._executeStaticEffects(); 2031 this._executeStaticEffects();
2089 this._applyConfig(this._config, this._aboveConfig); 2032 this._applyConfig(this._config, this._aboveConfig);
2090 this._flushHandlers(); 2033 this._flushHandlers();
2091 }, 2034 },
2092 _applyConfig: function (config, aboveConfig) { 2035 _applyConfig: function (config, aboveConfig) {
2093 for (var n in config) { 2036 for (var n in config) {
2094 if (this[n] === undefined) { 2037 if (this[n] === undefined) {
2095 this.__setProperty(n, config[n], n in aboveConfig); 2038 this.__setProperty(n, config[n], n in aboveConfig);
2096 } 2039 }
2097 } 2040 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, 2359 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect,
2417 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect, 2360 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect,
2418 _computePathEffect: Polymer.Base._computePathEffect, 2361 _computePathEffect: Polymer.Base._computePathEffect,
2419 _notifyBoundPaths: Polymer.Base._notifyBoundPaths, 2362 _notifyBoundPaths: Polymer.Base._notifyBoundPaths,
2420 _getPathParts: Polymer.Base._getPathParts 2363 _getPathParts: Polymer.Base._getPathParts
2421 }); 2364 });
2422 } 2365 }
2423 }); 2366 });
2424 }());Polymer.Base._addFeature({ 2367 }());Polymer.Base._addFeature({
2425 resolveUrl: function (url) { 2368 resolveUrl: function (url) {
2426 var module = Polymer.DomModule.import(this.is); 2369 return Polymer.ResolveUrl.resolveUrl(url, this._importPath);
2427 var root = '';
2428 if (module) {
2429 var assetPath = module.getAttribute('assetpath') || '';
2430 root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
2431 }
2432 return Polymer.ResolveUrl.resolveUrl(url, root);
2433 } 2370 }
2434 });Polymer.CssParse = function () { 2371 });Polymer.CssParse = function () {
2435 return { 2372 return {
2436 parse: function (text) { 2373 parse: function (text) {
2437 text = this._clean(text); 2374 text = this._clean(text);
2438 return this._parseCss(this._lex(text), text); 2375 return this._parseCss(this._lex(text), text);
2439 }, 2376 },
2440 _clean: function (cssText) { 2377 _clean: function (cssText) {
2441 return cssText.replace(this._rx.comments, '').replace(this._rx.port, ''); 2378 return cssText.replace(this._rx.comments, '').replace(this._rx.port, '');
2442 }, 2379 },
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4747 }, 4684 },
4748 detached: function () { 4685 detached: function () {
4749 this.__isDetached = true; 4686 this.__isDetached = true;
4750 for (var i = 0; i < this._instances.length; i++) { 4687 for (var i = 0; i < this._instances.length; i++) {
4751 this._detachInstance(i); 4688 this._detachInstance(i);
4752 } 4689 }
4753 }, 4690 },
4754 attached: function () { 4691 attached: function () {
4755 if (this.__isDetached) { 4692 if (this.__isDetached) {
4756 this.__isDetached = false; 4693 this.__isDetached = false;
4757 var parent = Polymer.dom(Polymer.dom(this).parentNode); 4694 var refNode;
4695 var parentNode = Polymer.dom(this).parentNode;
4696 if (parentNode.localName == this.is) {
4697 refNode = parentNode;
4698 parentNode = Polymer.dom(parentNode).parentNode;
4699 } else {
4700 refNode = this;
4701 }
4702 var parent = Polymer.dom(parentNode);
4758 for (var i = 0; i < this._instances.length; i++) { 4703 for (var i = 0; i < this._instances.length; i++) {
4759 this._attachInstance(i, parent); 4704 this._attachInstance(i, parent, refNode);
4760 } 4705 }
4761 } 4706 }
4762 }, 4707 },
4763 ready: function () { 4708 ready: function () {
4764 this._instanceProps = { __key__: true }; 4709 this._instanceProps = { __key__: true };
4765 this._instanceProps[this.as] = true; 4710 this._instanceProps[this.as] = true;
4766 this._instanceProps[this.indexAs] = true; 4711 this._instanceProps[this.indexAs] = true;
4767 if (!this.ctor) { 4712 if (!this.ctor) {
4768 this.templatize(this); 4713 this.templatize(this);
4769 } 4714 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
5033 _detachInstance: function (idx) { 4978 _detachInstance: function (idx) {
5034 var inst = this._instances[idx]; 4979 var inst = this._instances[idx];
5035 if (!inst.isPlaceholder) { 4980 if (!inst.isPlaceholder) {
5036 for (var i = 0; i < inst._children.length; i++) { 4981 for (var i = 0; i < inst._children.length; i++) {
5037 var el = inst._children[i]; 4982 var el = inst._children[i];
5038 Polymer.dom(inst.root).appendChild(el); 4983 Polymer.dom(inst.root).appendChild(el);
5039 } 4984 }
5040 return inst; 4985 return inst;
5041 } 4986 }
5042 }, 4987 },
5043 _attachInstance: function (idx, parent) { 4988 _attachInstance: function (idx, parent, refNode) {
5044 var inst = this._instances[idx]; 4989 var inst = this._instances[idx];
5045 if (!inst.isPlaceholder) { 4990 if (!inst.isPlaceholder) {
5046 parent.insertBefore(inst.root, this); 4991 parent.insertBefore(inst.root, refNode);
5047 } 4992 }
5048 }, 4993 },
5049 _detachAndRemoveInstance: function (idx) { 4994 _detachAndRemoveInstance: function (idx) {
5050 var inst = this._detachInstance(idx); 4995 var inst = this._detachInstance(idx);
5051 if (inst) { 4996 if (inst) {
5052 this._pool.push(inst); 4997 this._pool.push(inst);
5053 } 4998 }
5054 this._instances.splice(idx, 1); 4999 this._instances.splice(idx, 1);
5055 }, 5000 },
5056 _insertPlaceholder: function (idx, key) { 5001 _insertPlaceholder: function (idx, key) {
(...skipping 12 matching lines...) Expand all
5069 var inst = this._pool.pop(); 5014 var inst = this._pool.pop();
5070 if (inst) { 5015 if (inst) {
5071 inst.__setProperty(this.as, this.collection.getItem(key), true); 5016 inst.__setProperty(this.as, this.collection.getItem(key), true);
5072 inst.__setProperty('__key__', key, true); 5017 inst.__setProperty('__key__', key, true);
5073 } else { 5018 } else {
5074 inst = this._stampInstance(idx, key); 5019 inst = this._stampInstance(idx, key);
5075 } 5020 }
5076 var beforeRow = this._instances[idx + 1]; 5021 var beforeRow = this._instances[idx + 1];
5077 var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0] : this; 5022 var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0] : this;
5078 var parentNode = Polymer.dom(this).parentNode; 5023 var parentNode = Polymer.dom(this).parentNode;
5024 if (parentNode.localName == this.is) {
5025 if (beforeNode == this) {
5026 beforeNode = parentNode;
5027 }
5028 parentNode = Polymer.dom(parentNode).parentNode;
5029 }
5079 Polymer.dom(parentNode).insertBefore(inst.root, beforeNode); 5030 Polymer.dom(parentNode).insertBefore(inst.root, beforeNode);
5080 this._instances[idx] = inst; 5031 this._instances[idx] = inst;
5081 return inst; 5032 return inst;
5082 }, 5033 },
5083 _downgradeInstance: function (idx, key) { 5034 _downgradeInstance: function (idx, key) {
5084 var inst = this._detachInstance(idx); 5035 var inst = this._detachInstance(idx);
5085 if (inst) { 5036 if (inst) {
5086 this._pool.push(inst); 5037 this._pool.push(inst);
5087 } 5038 }
5088 inst = { 5039 inst = {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
5264 value: false, 5215 value: false,
5265 observer: '_queueRender' 5216 observer: '_queueRender'
5266 }, 5217 },
5267 notifyDomChange: { type: Boolean } 5218 notifyDomChange: { type: Boolean }
5268 }, 5219 },
5269 behaviors: [Polymer.Templatizer], 5220 behaviors: [Polymer.Templatizer],
5270 _queueRender: function () { 5221 _queueRender: function () {
5271 this._debounceTemplate(this._render); 5222 this._debounceTemplate(this._render);
5272 }, 5223 },
5273 detached: function () { 5224 detached: function () {
5274 if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && (!Polymer.Settings.hasShadow || !(this.parentNode instanceof ShadowRoot))) { 5225 var parentNode = this.parentNode;
5226 if (parentNode && parentNode.localName == this.is) {
5227 parentNode = Polymer.dom(parentNode).parentNode;
5228 }
5229 if (!parentNode || parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && (!Polym er.Settings.hasShadow || !(parentNode instanceof ShadowRoot))) {
5275 this._teardownInstance(); 5230 this._teardownInstance();
5276 } 5231 }
5277 }, 5232 },
5278 attached: function () { 5233 attached: function () {
5279 if (this.if && this.ctor) { 5234 if (this.if && this.ctor) {
5280 this.async(this._ensureInstance); 5235 this.async(this._ensureInstance);
5281 } 5236 }
5282 }, 5237 },
5283 render: function () { 5238 render: function () {
5284 this._flushTemplates(); 5239 this._flushTemplates();
(...skipping 12 matching lines...) Expand all
5297 this._showHideChildren(); 5252 this._showHideChildren();
5298 } 5253 }
5299 if (this.if != this._lastIf) { 5254 if (this.if != this._lastIf) {
5300 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { 5255 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) {
5301 this.fire('dom-change'); 5256 this.fire('dom-change');
5302 } 5257 }
5303 this._lastIf = this.if; 5258 this._lastIf = this.if;
5304 } 5259 }
5305 }, 5260 },
5306 _ensureInstance: function () { 5261 _ensureInstance: function () {
5262 var refNode;
5307 var parentNode = Polymer.dom(this).parentNode; 5263 var parentNode = Polymer.dom(this).parentNode;
5264 if (parentNode && parentNode.localName == this.is) {
5265 refNode = parentNode;
5266 parentNode = Polymer.dom(parentNode).parentNode;
5267 } else {
5268 refNode = this;
5269 }
5308 if (parentNode) { 5270 if (parentNode) {
5309 var parent = Polymer.dom(parentNode);
5310 if (!this._instance) { 5271 if (!this._instance) {
5311 this._instance = this.stamp(); 5272 this._instance = this.stamp();
5312 var root = this._instance.root; 5273 var root = this._instance.root;
5313 parent.insertBefore(root, this); 5274 Polymer.dom(parentNode).insertBefore(root, refNode);
5314 } else { 5275 } else {
5315 var c$ = this._instance._children; 5276 var c$ = this._instance._children;
5316 if (c$ && c$.length) { 5277 if (c$ && c$.length) {
5317 var lastChild = Polymer.dom(this).previousSibling; 5278 var lastChild = Polymer.dom(refNode).previousSibling;
5318 if (lastChild !== c$[c$.length - 1]) { 5279 if (lastChild !== c$[c$.length - 1]) {
5319 for (var i = 0, n; i < c$.length && (n = c$[i]); i++) { 5280 for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
5320 parent.insertBefore(n, this); 5281 Polymer.dom(parentNode).insertBefore(n, refNode);
5321 } 5282 }
5322 } 5283 }
5323 } 5284 }
5324 } 5285 }
5325 } 5286 }
5326 }, 5287 },
5327 _teardownInstance: function () { 5288 _teardownInstance: function () {
5328 if (this._instance) { 5289 if (this._instance) {
5329 var c$ = this._instance._children; 5290 var c$ = this._instance._children;
5330 if (c$ && c$.length) { 5291 if (c$ && c$.length) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
5375 } 5336 }
5376 }, 5337 },
5377 _markImportsReady: function () { 5338 _markImportsReady: function () {
5378 this._importsReady = true; 5339 this._importsReady = true;
5379 this._ensureReady(); 5340 this._ensureReady();
5380 }, 5341 },
5381 _registerFeatures: function () { 5342 _registerFeatures: function () {
5382 this._prepConstructor(); 5343 this._prepConstructor();
5383 }, 5344 },
5384 _insertChildren: function () { 5345 _insertChildren: function () {
5385 var parentDom = Polymer.dom(Polymer.dom(this).parentNode); 5346 var refNode;
5386 parentDom.insertBefore(this.root, this); 5347 var parentNode = Polymer.dom(this).parentNode;
5348 if (parentNode.localName == this.is) {
5349 refNode = parentNode;
5350 parentNode = Polymer.dom(parentNode).parentNode;
5351 } else {
5352 refNode = this;
5353 }
5354 Polymer.dom(parentNode).insertBefore(this.root, refNode);
5387 }, 5355 },
5388 _removeChildren: function () { 5356 _removeChildren: function () {
5389 if (this._children) { 5357 if (this._children) {
5390 for (var i = 0; i < this._children.length; i++) { 5358 for (var i = 0; i < this._children.length; i++) {
5391 this.root.appendChild(this._children[i]); 5359 this.root.appendChild(this._children[i]);
5392 } 5360 }
5393 } 5361 }
5394 }, 5362 },
5395 _initFeatures: function () { 5363 _initFeatures: function () {
5396 }, 5364 },
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5433 this._prepPropertyInfo(); 5401 this._prepPropertyInfo();
5434 Polymer.Base._initFeatures.call(this); 5402 Polymer.Base._initFeatures.call(this);
5435 this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root); 5403 this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root);
5436 } 5404 }
5437 this._insertChildren(); 5405 this._insertChildren();
5438 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { 5406 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) {
5439 this.fire('dom-change'); 5407 this.fire('dom-change');
5440 } 5408 }
5441 } 5409 }
5442 }); 5410 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698