fix(rrweb-snapshot): don't exclude @import CSS rules from the output and use CSSRule.cssText instead when they throw an exception while accessing their CSSStyleSheet.cssRules property (#720)
This commit is contained in:
@@ -49,9 +49,13 @@ function getCssRulesString(s: CSSStyleSheet): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getCssRuleString(rule: CSSRule): string {
|
function getCssRuleString(rule: CSSRule): string {
|
||||||
return isCSSImportRule(rule)
|
let cssStringified = rule.cssText;
|
||||||
? getCssRulesString(rule.styleSheet) || ''
|
if (isCSSImportRule(rule)) {
|
||||||
: rule.cssText;
|
try {
|
||||||
|
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
return cssStringified;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCSSImportRule(rule: CSSRule): rule is CSSImportRule {
|
function isCSSImportRule(rule: CSSRule): rule is CSSImportRule {
|
||||||
|
|||||||
Reference in New Issue
Block a user