fix and default

This commit is contained in:
Henry Jameson 2025-07-03 21:21:21 +03:00
commit 1d729cb0c5

View file

@ -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.