tolerate insertRule error since browser may throw Error on wrong prefix

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent c68d3e1803
commit 67ef897454

View File

@@ -630,7 +630,14 @@ export class Replayer {
index === undefined
? undefined
: Math.min(index, styleSheet.rules.length);
styleSheet.insertRule(rule, _index);
try {
styleSheet.insertRule(rule, _index);
} catch (e) {
/**
* sometimes we may capture rules with browser prefix
* insert rule with prefixs in other browsers may cause Error
*/
}
});
}