diff --git a/lib/elements/custom-style.html b/lib/elements/custom-style.html index 651fe94bbf..3dd0cfb498 100644 --- a/lib/elements/custom-style.html +++ b/lib/elements/custom-style.html @@ -13,7 +13,8 @@ (function() { 'use strict'; - const attr = 'include'; + const INCLUDE = 'include'; + const TYPE = 'type'; const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface; @@ -86,9 +87,9 @@ return null; } this._style = style; - const include = style.getAttribute(attr); + const include = style.getAttribute(INCLUDE); if (include) { - style.removeAttribute(attr); + style.removeAttribute(INCLUDE); style.textContent = Polymer.StyleGather.cssFromModules(include) + style.textContent; } /* @@ -101,7 +102,14 @@ The ordering of `` should stay the same as when loaded by HTML Imports, but there may be odd cases of ordering w.r.t the main document styles. */ - if (this.ownerDocument !== window.document) { + const owner = window.HTMLImports && HTMLImports.importForElement ? + HTMLImports.importForElement(this) || document : this.ownerDocument; + if (owner !== window.document) { + // Allow users to add `type="custom"` to