Merge pull request 'Do not crash even on css rule insertion failure' (#3520) from tusooa/pleroma-fe:tusooa/no-crash-on-bad-style into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3520
This commit is contained in:
commit
7a5a40b237
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)
|
.sort((a, b) => a.priority - b.priority)
|
||||||
.map((sheet) => {
|
.map((sheet) => {
|
||||||
const css = new CSSStyleSheet()
|
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
|
return css
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue