diff --git a/src/sandbox/patchers/css.ts b/src/sandbox/patchers/css.ts index 510384f3c..b07bf9ea4 100644 --- a/src/sandbox/patchers/css.ts +++ b/src/sandbox/patchers/css.ts @@ -102,7 +102,10 @@ export class ScopedCSS { css += this.ruleSupport(rule as CSSSupportsRule, prefix); break; default: - css += `${rule.cssText}`; + if (typeof rule.cssText === 'string') { + css += `${rule.cssText}`; + } + break; } }); @@ -121,7 +124,11 @@ export class ScopedCSS { const selector = rule.selectorText.trim(); - let { cssText } = rule; + let cssText = ''; + if (typeof rule.cssText === 'string') { + cssText = rule.cssText; + } + // handle html { ... } // handle body { ... } // handle :root { ... }