|
105 | 105 | var cssText = ''; |
106 | 106 | var e$ = Array.prototype.slice.call( |
107 | 107 | element.querySelectorAll(this.MODULE_STYLES_SELECTOR)); |
108 | | - for (var i=0, e; i < e$.length; i++) { |
| 108 | + for (var i=0, e, addModule; i < e$.length; i++) { |
109 | 109 | e = e$[i]; |
| 110 | + addModule = null; |
110 | 111 | // look inside templates for elements |
111 | 112 | if (e.localName === 'template') { |
112 | 113 | cssText += this._cssFromElement(e.content); |
113 | 114 | } else { |
114 | 115 | // style elements inside dom-modules will apply to the main document |
115 | 116 | // we don't want this, so we remove them here. |
116 | 117 | if (e.localName === 'style') { |
| 118 | + addModule = e.getAttribute('module'); |
117 | 119 | // get style element applied to main doc via HTMLImports polyfill |
118 | 120 | e = e.__appliedElement || e; |
119 | 121 | e.parentNode.removeChild(e); |
120 | 122 | // it's an import, assume this is a text file of css content. |
121 | 123 | } else { |
| 124 | + // TODO(sorvell): plan is to deprecate this way to get styles; |
| 125 | + // remember to add deprecation warning when this is done. |
122 | 126 | e = e.import && e.import.body; |
123 | 127 | } |
124 | 128 | // adjust paths in css. |
|
127 | 131 | } |
128 | 132 | } |
129 | 133 | // now support module refs on 'styling' elements |
130 | | - var module = e.getAttribute('module'); |
131 | | - if (module) { |
132 | | - cssText += this.cssFromModules(module); |
| 134 | + if (addModule) { |
| 135 | + cssText += this.cssFromModules(addModule); |
133 | 136 | } |
134 | 137 | } |
135 | 138 | return cssText; |
136 | 139 | }, |
137 | | - |
| 140 | + |
138 | 141 | resolveCss: Polymer.ResolveUrl.resolveCss, |
139 | 142 | parser: Polymer.CssParse, |
140 | 143 | ruleTypes: Polymer.CssParse.types |
|
0 commit comments