OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --><!-- | 9 --><!-- |
10 @license | 10 @license |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) { | 250 for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) { |
251 if (annote.index === i++) { | 251 if (annote.index === i++) { |
252 return n; | 252 return n; |
253 } | 253 } |
254 } | 254 } |
255 } else { | 255 } else { |
256 return root; | 256 return root; |
257 } | 257 } |
258 } | 258 } |
259 }; | 259 }; |
260 }());(function () { | |
261 function resolveCss(cssText, ownerDocument) { | |
262 return cssText.replace(CSS_URL_RX, function (m, pre, url, post) { | |
263 return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + po
st; | |
264 }); | |
265 } | |
266 function resolveAttrs(element, ownerDocument) { | |
267 for (var name in URL_ATTRS) { | |
268 var a$ = URL_ATTRS[name]; | |
269 for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) { | |
270 if (name === '*' || element.localName === name) { | |
271 at = element.attributes[a]; | |
272 v = at && at.value; | |
273 if (v && v.search(BINDING_RX) < 0) { | |
274 at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocume
nt); | |
275 } | |
276 } | |
277 } | |
278 } | |
279 } | |
280 function resolve(url, ownerDocument) { | |
281 if (url && ABS_URL.test(url)) { | |
282 return url; | |
283 } | |
284 var resolver = getUrlResolver(ownerDocument); | |
285 resolver.href = url; | |
286 return resolver.href || url; | |
287 } | |
288 var tempDoc; | |
289 var tempDocBase; | |
290 function resolveUrl(url, baseUri) { | |
291 if (!tempDoc) { | |
292 tempDoc = document.implementation.createHTMLDocument('temp'); | |
293 tempDocBase = tempDoc.createElement('base'); | |
294 tempDoc.head.appendChild(tempDocBase); | |
295 } | |
296 tempDocBase.href = baseUri; | |
297 return resolve(url, tempDoc); | |
298 } | |
299 function getUrlResolver(ownerDocument) { | |
300 return ownerDocument.body.__urlResolver || (ownerDocument.body.__urlResolver = o
wnerDocument.createElement('a')); | |
301 } | |
302 var CSS_URL_RX = /(url\()([^)]*)(\))/g; | |
303 var URL_ATTRS = { | |
304 '*': [ | |
305 'href', | |
306 'src', | |
307 'style', | |
308 'url' | |
309 ], | |
310 form: ['action'] | |
311 }; | |
312 var ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/; | |
313 var BINDING_RX = /\{\{|\[\[/; | |
314 Polymer.ResolveUrl = { | |
315 resolveCss: resolveCss, | |
316 resolveAttrs: resolveAttrs, | |
317 resolveUrl: resolveUrl | |
318 }; | |
319 }());Polymer.Path = { | 260 }());Polymer.Path = { |
320 root: function (path) { | 261 root: function (path) { |
321 var dotIndex = path.indexOf('.'); | 262 var dotIndex = path.indexOf('.'); |
322 if (dotIndex === -1) { | 263 if (dotIndex === -1) { |
323 return path; | 264 return path; |
324 } | 265 } |
325 return path.slice(0, dotIndex); | 266 return path.slice(0, dotIndex); |
326 }, | 267 }, |
327 isDeep: function (path) { | 268 isDeep: function (path) { |
328 return path.indexOf('.') !== -1; | 269 return path.indexOf('.') !== -1; |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 } | 2035 } |
2095 node._configValue(name, value); | 2036 node._configValue(name, value); |
2096 } | 2037 } |
2097 } | 2038 } |
2098 } | 2039 } |
2099 } | 2040 } |
2100 } | 2041 } |
2101 } | 2042 } |
2102 }, | 2043 }, |
2103 _afterClientsReady: function () { | 2044 _afterClientsReady: function () { |
| 2045 this.importPath = this._importPath; |
| 2046 this.rootPath = Polymer.rootPath; |
2104 this._executeStaticEffects(); | 2047 this._executeStaticEffects(); |
2105 this._applyConfig(this._config, this._aboveConfig); | 2048 this._applyConfig(this._config, this._aboveConfig); |
2106 this._flushHandlers(); | 2049 this._flushHandlers(); |
2107 }, | 2050 }, |
2108 _applyConfig: function (config, aboveConfig) { | 2051 _applyConfig: function (config, aboveConfig) { |
2109 for (var n in config) { | 2052 for (var n in config) { |
2110 if (this[n] === undefined) { | 2053 if (this[n] === undefined) { |
2111 this.__setProperty(n, config[n], n in aboveConfig); | 2054 this.__setProperty(n, config[n], n in aboveConfig); |
2112 } | 2055 } |
2113 } | 2056 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, | 2375 _complexObserverPathEffect: Polymer.Base._complexObserverPathEffect, |
2433 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect, | 2376 _annotatedComputationPathEffect: Polymer.Base._annotatedComputationPathEffect, |
2434 _computePathEffect: Polymer.Base._computePathEffect, | 2377 _computePathEffect: Polymer.Base._computePathEffect, |
2435 _notifyBoundPaths: Polymer.Base._notifyBoundPaths, | 2378 _notifyBoundPaths: Polymer.Base._notifyBoundPaths, |
2436 _getPathParts: Polymer.Base._getPathParts | 2379 _getPathParts: Polymer.Base._getPathParts |
2437 }); | 2380 }); |
2438 } | 2381 } |
2439 }); | 2382 }); |
2440 }());Polymer.Base._addFeature({ | 2383 }());Polymer.Base._addFeature({ |
2441 resolveUrl: function (url) { | 2384 resolveUrl: function (url) { |
2442 var module = Polymer.DomModule.import(this.is); | 2385 return Polymer.ResolveUrl.resolveUrl(url, this._importPath); |
2443 var root = ''; | |
2444 if (module) { | |
2445 var assetPath = module.getAttribute('assetpath') || ''; | |
2446 root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI); | |
2447 } | |
2448 return Polymer.ResolveUrl.resolveUrl(url, root); | |
2449 } | 2386 } |
2450 });Polymer.CssParse = function () { | 2387 });Polymer.CssParse = function () { |
2451 return { | 2388 return { |
2452 parse: function (text) { | 2389 parse: function (text) { |
2453 text = this._clean(text); | 2390 text = this._clean(text); |
2454 return this._parseCss(this._lex(text), text); | 2391 return this._parseCss(this._lex(text), text); |
2455 }, | 2392 }, |
2456 _clean: function (cssText) { | 2393 _clean: function (cssText) { |
2457 return cssText.replace(this._rx.comments, '').replace(this._rx.port, ''); | 2394 return cssText.replace(this._rx.comments, '').replace(this._rx.port, ''); |
2458 }, | 2395 }, |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 }, | 2958 }, |
3022 documentRule: function (rule) { | 2959 documentRule: function (rule) { |
3023 rule.selector = rule.parsedSelector; | 2960 rule.selector = rule.parsedSelector; |
3024 this.normalizeRootSelector(rule); | 2961 this.normalizeRootSelector(rule); |
3025 if (!settings.useNativeShadow) { | 2962 if (!settings.useNativeShadow) { |
3026 this._transformRule(rule, this._transformDocumentSelector); | 2963 this._transformRule(rule, this._transformDocumentSelector); |
3027 } | 2964 } |
3028 }, | 2965 }, |
3029 normalizeRootSelector: function (rule) { | 2966 normalizeRootSelector: function (rule) { |
3030 rule.selector = rule.selector.replace(ROOT, 'html'); | 2967 rule.selector = rule.selector.replace(ROOT, 'html'); |
| 2968 var parts = rule.selector.split(COMPLEX_SELECTOR_SEP); |
| 2969 parts = parts.filter(function (part) { |
| 2970 return !part.match(HOST_OR_HOST_GT_STAR); |
| 2971 }); |
| 2972 rule.selector = parts.join(COMPLEX_SELECTOR_SEP); |
3031 }, | 2973 }, |
3032 _transformDocumentSelector: function (selector) { | 2974 _transformDocumentSelector: function (selector) { |
3033 return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCO
PE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELE
CTOR); | 2975 return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCO
PE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELE
CTOR); |
3034 }, | 2976 }, |
3035 _slottedToContent: function (cssText) { | 2977 _slottedToContent: function (cssText) { |
3036 return cssText.replace(SLOTTED_PAREN, CONTENT + '> $1'); | 2978 return cssText.replace(SLOTTED_PAREN, CONTENT + '> $1'); |
3037 }, | 2979 }, |
3038 SCOPE_NAME: 'style-scope' | 2980 SCOPE_NAME: 'style-scope' |
3039 }; | 2981 }; |
3040 var SCOPE_NAME = api.SCOPE_NAME; | 2982 var SCOPE_NAME = api.SCOPE_NAME; |
3041 var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME +
')'; | 2983 var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME +
')'; |
3042 var COMPLEX_SELECTOR_SEP = ','; | 2984 var COMPLEX_SELECTOR_SEP = ','; |
3043 var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g; | 2985 var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g; |
3044 var SIMPLE_SELECTOR_PREFIX = /[[.:#*]/; | 2986 var SIMPLE_SELECTOR_PREFIX = /[[.:#*]/; |
3045 var HOST = ':host'; | 2987 var HOST = ':host'; |
3046 var ROOT = ':root'; | 2988 var ROOT = ':root'; |
3047 var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; | 2989 var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/; |
3048 var HOST_CONTEXT = ':host-context'; | 2990 var HOST_CONTEXT = ':host-context'; |
3049 var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))
(.*)/; | 2991 var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))
(.*)/; |
3050 var CONTENT = '::content'; | 2992 var CONTENT = '::content'; |
3051 var SCOPE_JUMP = /::content|::shadow|\/deep\//; | 2993 var SCOPE_JUMP = /::content|::shadow|\/deep\//; |
3052 var CSS_CLASS_PREFIX = '.'; | 2994 var CSS_CLASS_PREFIX = '.'; |
3053 var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~='; | 2995 var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~='; |
3054 var CSS_ATTR_SUFFIX = ']'; | 2996 var CSS_ATTR_SUFFIX = ']'; |
3055 var PSEUDO_PREFIX = ':'; | 2997 var PSEUDO_PREFIX = ':'; |
3056 var CLASS = 'class'; | 2998 var CLASS = 'class'; |
3057 var CONTENT_START = new RegExp('^(' + CONTENT + ')'); | 2999 var CONTENT_START = new RegExp('^(' + CONTENT + ')'); |
3058 var SELECTOR_NO_MATCH = 'should_not_match'; | 3000 var SELECTOR_NO_MATCH = 'should_not_match'; |
3059 var SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; | 3001 var SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; |
| 3002 var HOST_OR_HOST_GT_STAR = /:host(?:\s*>\s*\*)?/; |
3060 return api; | 3003 return api; |
3061 }();Polymer.StyleExtends = function () { | 3004 }();Polymer.StyleExtends = function () { |
3062 var styleUtil = Polymer.StyleUtil; | 3005 var styleUtil = Polymer.StyleUtil; |
3063 return { | 3006 return { |
3064 hasExtends: function (cssText) { | 3007 hasExtends: function (cssText) { |
3065 return Boolean(cssText.match(this.rx.EXTEND)); | 3008 return Boolean(cssText.match(this.rx.EXTEND)); |
3066 }, | 3009 }, |
3067 transform: function (style) { | 3010 transform: function (style) { |
3068 var rules = styleUtil.rulesForStyle(style); | 3011 var rules = styleUtil.rulesForStyle(style); |
3069 var self = this; | 3012 var self = this; |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4763 }, | 4706 }, |
4764 detached: function () { | 4707 detached: function () { |
4765 this.__isDetached = true; | 4708 this.__isDetached = true; |
4766 for (var i = 0; i < this._instances.length; i++) { | 4709 for (var i = 0; i < this._instances.length; i++) { |
4767 this._detachInstance(i); | 4710 this._detachInstance(i); |
4768 } | 4711 } |
4769 }, | 4712 }, |
4770 attached: function () { | 4713 attached: function () { |
4771 if (this.__isDetached) { | 4714 if (this.__isDetached) { |
4772 this.__isDetached = false; | 4715 this.__isDetached = false; |
4773 var parent = Polymer.dom(Polymer.dom(this).parentNode); | 4716 var refNode; |
| 4717 var parentNode = Polymer.dom(this).parentNode; |
| 4718 if (parentNode.localName == this.is) { |
| 4719 refNode = parentNode; |
| 4720 parentNode = Polymer.dom(parentNode).parentNode; |
| 4721 } else { |
| 4722 refNode = this; |
| 4723 } |
| 4724 var parent = Polymer.dom(parentNode); |
4774 for (var i = 0; i < this._instances.length; i++) { | 4725 for (var i = 0; i < this._instances.length; i++) { |
4775 this._attachInstance(i, parent); | 4726 this._attachInstance(i, parent, refNode); |
4776 } | 4727 } |
4777 } | 4728 } |
4778 }, | 4729 }, |
4779 ready: function () { | 4730 ready: function () { |
4780 this._instanceProps = { __key__: true }; | 4731 this._instanceProps = { __key__: true }; |
4781 this._instanceProps[this.as] = true; | 4732 this._instanceProps[this.as] = true; |
4782 this._instanceProps[this.indexAs] = true; | 4733 this._instanceProps[this.indexAs] = true; |
4783 if (!this.ctor) { | 4734 if (!this.ctor) { |
4784 this.templatize(this); | 4735 this.templatize(this); |
4785 } | 4736 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5049 _detachInstance: function (idx) { | 5000 _detachInstance: function (idx) { |
5050 var inst = this._instances[idx]; | 5001 var inst = this._instances[idx]; |
5051 if (!inst.isPlaceholder) { | 5002 if (!inst.isPlaceholder) { |
5052 for (var i = 0; i < inst._children.length; i++) { | 5003 for (var i = 0; i < inst._children.length; i++) { |
5053 var el = inst._children[i]; | 5004 var el = inst._children[i]; |
5054 Polymer.dom(inst.root).appendChild(el); | 5005 Polymer.dom(inst.root).appendChild(el); |
5055 } | 5006 } |
5056 return inst; | 5007 return inst; |
5057 } | 5008 } |
5058 }, | 5009 }, |
5059 _attachInstance: function (idx, parent) { | 5010 _attachInstance: function (idx, parent, refNode) { |
5060 var inst = this._instances[idx]; | 5011 var inst = this._instances[idx]; |
5061 if (!inst.isPlaceholder) { | 5012 if (!inst.isPlaceholder) { |
5062 parent.insertBefore(inst.root, this); | 5013 parent.insertBefore(inst.root, refNode); |
5063 } | 5014 } |
5064 }, | 5015 }, |
5065 _detachAndRemoveInstance: function (idx) { | 5016 _detachAndRemoveInstance: function (idx) { |
5066 var inst = this._detachInstance(idx); | 5017 var inst = this._detachInstance(idx); |
5067 if (inst) { | 5018 if (inst) { |
5068 this._pool.push(inst); | 5019 this._pool.push(inst); |
5069 } | 5020 } |
5070 this._instances.splice(idx, 1); | 5021 this._instances.splice(idx, 1); |
5071 }, | 5022 }, |
5072 _insertPlaceholder: function (idx, key) { | 5023 _insertPlaceholder: function (idx, key) { |
(...skipping 12 matching lines...) Expand all Loading... |
5085 var inst = this._pool.pop(); | 5036 var inst = this._pool.pop(); |
5086 if (inst) { | 5037 if (inst) { |
5087 inst.__setProperty(this.as, this.collection.getItem(key), true); | 5038 inst.__setProperty(this.as, this.collection.getItem(key), true); |
5088 inst.__setProperty('__key__', key, true); | 5039 inst.__setProperty('__key__', key, true); |
5089 } else { | 5040 } else { |
5090 inst = this._stampInstance(idx, key); | 5041 inst = this._stampInstance(idx, key); |
5091 } | 5042 } |
5092 var beforeRow = this._instances[idx + 1]; | 5043 var beforeRow = this._instances[idx + 1]; |
5093 var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0]
: this; | 5044 var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0]
: this; |
5094 var parentNode = Polymer.dom(this).parentNode; | 5045 var parentNode = Polymer.dom(this).parentNode; |
| 5046 if (parentNode.localName == this.is) { |
| 5047 if (beforeNode == this) { |
| 5048 beforeNode = parentNode; |
| 5049 } |
| 5050 parentNode = Polymer.dom(parentNode).parentNode; |
| 5051 } |
5095 Polymer.dom(parentNode).insertBefore(inst.root, beforeNode); | 5052 Polymer.dom(parentNode).insertBefore(inst.root, beforeNode); |
5096 this._instances[idx] = inst; | 5053 this._instances[idx] = inst; |
5097 return inst; | 5054 return inst; |
5098 }, | 5055 }, |
5099 _downgradeInstance: function (idx, key) { | 5056 _downgradeInstance: function (idx, key) { |
5100 var inst = this._detachInstance(idx); | 5057 var inst = this._detachInstance(idx); |
5101 if (inst) { | 5058 if (inst) { |
5102 this._pool.push(inst); | 5059 this._pool.push(inst); |
5103 } | 5060 } |
5104 inst = { | 5061 inst = { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5280 value: false, | 5237 value: false, |
5281 observer: '_queueRender' | 5238 observer: '_queueRender' |
5282 }, | 5239 }, |
5283 notifyDomChange: { type: Boolean } | 5240 notifyDomChange: { type: Boolean } |
5284 }, | 5241 }, |
5285 behaviors: [Polymer.Templatizer], | 5242 behaviors: [Polymer.Templatizer], |
5286 _queueRender: function () { | 5243 _queueRender: function () { |
5287 this._debounceTemplate(this._render); | 5244 this._debounceTemplate(this._render); |
5288 }, | 5245 }, |
5289 detached: function () { | 5246 detached: function () { |
5290 if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE
&& (!Polymer.Settings.hasShadow || !(this.parentNode instanceof ShadowRoot))) { | 5247 var parentNode = this.parentNode; |
| 5248 if (parentNode && parentNode.localName == this.is) { |
| 5249 parentNode = Polymer.dom(parentNode).parentNode; |
| 5250 } |
| 5251 if (!parentNode || parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && (!Polym
er.Settings.hasShadow || !(parentNode instanceof ShadowRoot))) { |
5291 this._teardownInstance(); | 5252 this._teardownInstance(); |
5292 } | 5253 } |
5293 }, | 5254 }, |
5294 attached: function () { | 5255 attached: function () { |
5295 if (this.if && this.ctor) { | 5256 if (this.if && this.ctor) { |
5296 this.async(this._ensureInstance); | 5257 this.async(this._ensureInstance); |
5297 } | 5258 } |
5298 }, | 5259 }, |
5299 render: function () { | 5260 render: function () { |
5300 this._flushTemplates(); | 5261 this._flushTemplates(); |
(...skipping 12 matching lines...) Expand all Loading... |
5313 this._showHideChildren(); | 5274 this._showHideChildren(); |
5314 } | 5275 } |
5315 if (this.if != this._lastIf) { | 5276 if (this.if != this._lastIf) { |
5316 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { | 5277 if (!Polymer.Settings.suppressTemplateNotifications || this.notifyDomChange) { |
5317 this.fire('dom-change'); | 5278 this.fire('dom-change'); |
5318 } | 5279 } |
5319 this._lastIf = this.if; | 5280 this._lastIf = this.if; |
5320 } | 5281 } |
5321 }, | 5282 }, |
5322 _ensureInstance: function () { | 5283 _ensureInstance: function () { |
| 5284 var refNode; |
5323 var parentNode = Polymer.dom(this).parentNode; | 5285 var parentNode = Polymer.dom(this).parentNode; |
| 5286 if (parentNode && parentNode.localName == this.is) { |
| 5287 refNode = parentNode; |
| 5288 parentNode = Polymer.dom(parentNode).parentNode; |
| 5289 } else { |
| 5290 refNode = this; |
| 5291 } |
5324 if (parentNode) { | 5292 if (parentNode) { |
5325 var parent = Polymer.dom(parentNode); | |
5326 if (!this._instance) { | 5293 if (!this._instance) { |
5327 this._instance = this.stamp(); | 5294 this._instance = this.stamp(); |
5328 var root = this._instance.root; | 5295 var root = this._instance.root; |
5329 parent.insertBefore(root, this); | 5296 Polymer.dom(parentNode).insertBefore(root, refNode); |
5330 } else { | 5297 } else { |
5331 var c$ = this._instance._children; | 5298 var c$ = this._instance._children; |
5332 if (c$ && c$.length) { | 5299 if (c$ && c$.length) { |
5333 var lastChild = Polymer.dom(this).previousSibling; | 5300 var lastChild = Polymer.dom(refNode).previousSibling; |
5334 if (lastChild !== c$[c$.length - 1]) { | 5301 if (lastChild !== c$[c$.length - 1]) { |
5335 for (var i = 0, n; i < c$.length && (n = c$[i]); i++) { | 5302 for (var i = 0, n; i < c$.length && (n = c$[i]); i++) { |
5336 parent.insertBefore(n, this); | 5303 Polymer.dom(parentNode).insertBefore(n, refNode); |
5337 } | 5304 } |
5338 } | 5305 } |
5339 } | 5306 } |
5340 } | 5307 } |
5341 } | 5308 } |
5342 }, | 5309 }, |
5343 _teardownInstance: function () { | 5310 _teardownInstance: function () { |
5344 if (this._instance) { | 5311 if (this._instance) { |
5345 var c$ = this._instance._children; | 5312 var c$ = this._instance._children; |
5346 if (c$ && c$.length) { | 5313 if (c$ && c$.length) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5391 } | 5358 } |
5392 }, | 5359 }, |
5393 _markImportsReady: function () { | 5360 _markImportsReady: function () { |
5394 this._importsReady = true; | 5361 this._importsReady = true; |
5395 this._ensureReady(); | 5362 this._ensureReady(); |
5396 }, | 5363 }, |
5397 _registerFeatures: function () { | 5364 _registerFeatures: function () { |
5398 this._prepConstructor(); | 5365 this._prepConstructor(); |
5399 }, | 5366 }, |
5400 _insertChildren: function () { | 5367 _insertChildren: function () { |
5401 var parentDom = Polymer.dom(Polymer.dom(this).parentNode); | 5368 var refNode; |
5402 parentDom.insertBefore(this.root, this); | 5369 var parentNode = Polymer.dom(this).parentNode; |
| 5370 if (parentNode.localName == this.is) { |
| 5371 refNode = parentNode; |
| 5372 parentNode = Polymer.dom(parentNode).parentNode; |
| 5373 } else { |
| 5374 refNode = this; |
| 5375 } |
| 5376 Polymer.dom(parentNode).insertBefore(this.root, refNode); |
5403 }, | 5377 }, |
5404 _removeChildren: function () { | 5378 _removeChildren: function () { |
5405 if (this._children) { | 5379 if (this._children) { |
5406 for (var i = 0; i < this._children.length; i++) { | 5380 for (var i = 0; i < this._children.length; i++) { |
5407 this.root.appendChild(this._children[i]); | 5381 this.root.appendChild(this._children[i]); |
5408 } | 5382 } |
5409 } | 5383 } |
5410 }, | 5384 }, |
5411 _initFeatures: function () { | 5385 _initFeatures: function () { |
5412 }, | 5386 }, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 });</script> | 5432 });</script> |
5459 | 5433 |
5460 | 5434 |
5461 | 5435 |
5462 | 5436 |
5463 | 5437 |
5464 | 5438 |
5465 | 5439 |
5466 | 5440 |
5467 | 5441 |
5468 | |
OLD | NEW |