diff --git a/src/ShadowCSS.js b/src/ShadowCSS.js index a8dbfee..316fda6 100644 --- a/src/ShadowCSS.js +++ b/src/ShadowCSS.js @@ -518,15 +518,16 @@ var hostRuleRe = /@host[^{]*{(([^}]*?{[^{]*?}[\s\S]*?)+)}/gim, cssPolyfillUnscopedRuleCommentRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, - // note: :host pre-processed to -host. - cssColonHostRe = /(-host)(?:\(([^)]*)\))?([^,{]*)/gim, + // note: :host pre-processed to -shadowcsshost. + polyfillHost = '-shadowcsshost', + cssColonHostRe = new RegExp('(' + polyfillHost + + ')(?:\\(([^)]*)\\))?([^,{]*)', 'gim'), selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$', hostRe = /@host/gim, colonHostRe = /\:host/gim, - polyfillHost = '-host', /* host name without combinator */ - polyfillHostNoCombinator = '-host-no-combinator', - polyfillHostRe = /-host/gim; + polyfillHostNoCombinator = polyfillHost + '-no-combinator', + polyfillHostRe = new RegExp(polyfillHost, 'gim'); function stylesToCssText(styles, preserveComments) { var cssText = '';