fix and default
This commit is contained in:
parent
0f573637a7
commit
1d729cb0c5
1 changed files with 2 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ const supportsAdoptedStyleSheets = !!document.adoptedStyleSheets
|
||||||
|
|
||||||
const stylesheets = {}
|
const stylesheets = {}
|
||||||
|
|
||||||
export const createStyleSheet = (id, priority) => {
|
export const createStyleSheet = (id, priority = 1000) => {
|
||||||
if (stylesheets[id]) return stylesheets[id]
|
if (stylesheets[id]) return stylesheets[id]
|
||||||
const newStyleSheet = {
|
const newStyleSheet = {
|
||||||
rules: [],
|
rules: [],
|
||||||
|
|
@ -55,7 +55,7 @@ export const adoptStyleSheets = throttle(() => {
|
||||||
.filter(x => x.ready)
|
.filter(x => x.ready)
|
||||||
.sort((a, b) => a.priority - b.priority)
|
.sort((a, b) => a.priority - b.priority)
|
||||||
.forEach(sheet => {
|
.forEach(sheet => {
|
||||||
sheet.rules.forEach(r => holder.sheet.insertRule(r, holder.sheet.cssRules.length))
|
sheet.rules.forEach(r => holder.sheet.insertRule(r))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Some older browsers do not support document.adoptedStyleSheets.
|
// Some older browsers do not support document.adoptedStyleSheets.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue