From becb7ada7763e471b6f770f297b9d37ff270b818 Mon Sep 17 00:00:00 2001 From: "aique.li" <43040641+aique127@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20IE=20bug=20that=20cssText?= =?UTF-8?q?=20cannot=20be=20accessed=20while=20it=20prefixing=20with=20-we?= =?UTF-8?q?bkit=20(#2532)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sandbox/patchers/css.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 { ... }