Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Fix if adoptedStyleSheets is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksellen committed Dec 13, 2023
1 parent b30fca1 commit 5988c29
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils/components/SvgFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ import { raggedEdgeVariations } from '@/utils/svgUtils'
const variants = Array.from({ length: raggedEdgeVariations }, (_, i) => i + 1)
const styleSheet = new CSSStyleSheet()
for (const variant of variants) {
styleSheet.insertRule(`.ragged-edges-${variant} { filter: url(#ragged-edges-${variant})}`)
if (document.adoptedStyleSheets) {
// If adoptedStyleSheets is not supported it won't be enabled
const styleSheet = new CSSStyleSheet()
for (const variant of variants) {
styleSheet.insertRule(`.ragged-edges-${variant} { filter: url(#ragged-edges-${variant})}`)
}
document.adoptedStyleSheets.push(styleSheet)
}
document.adoptedStyleSheets.push(styleSheet)
</script>

0 comments on commit 5988c29

Please sign in to comment.