Do not crash even on css rule insertion failure
This commit is contained in:
parent
99d4b5c63e
commit
ed958736b3
2 changed files with 8 additions and 1 deletions
1
changelog.d/no-crash-on-bad-style.fix
Normal file
1
changelog.d/no-crash-on-bad-style.fix
Normal file
|
|
@ -0,0 +1 @@
|
|||
Do not crash even on css rule insertion failure
|
||||
|
|
@ -59,7 +59,13 @@ export const adoptStyleSheets = throttle(() => {
|
|||
.sort((a, b) => a.priority - b.priority)
|
||||
.map((sheet) => {
|
||||
const css = new CSSStyleSheet()
|
||||
sheet.rules.forEach((r) => css.insertRule(r))
|
||||
sheet.rules.forEach((r) => {
|
||||
try {
|
||||
css.insertRule(r)
|
||||
} catch (e) {
|
||||
console.warn('Error inserting rule:', e, r)
|
||||
}
|
||||
})
|
||||
return css
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue