Comparing version 4.0.2 to 4.0.3
{ | ||
"name": "style-mod", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "A minimal CSS module shim", | ||
@@ -5,0 +5,0 @@ "main": "dist/style-mod.cjs", |
@@ -83,16 +83,18 @@ const C = "\u037c" | ||
let adoptedSet = null | ||
let adoptedSet = new Map //<Document, StyleSet> | ||
class StyleSet { | ||
constructor(root) { | ||
if (!root.head && root.adoptedStyleSheets && typeof CSSStyleSheet != "undefined") { | ||
if (adoptedSet) { | ||
root.adoptedStyleSheets = [adoptedSet.sheet, ...root.adoptedStyleSheets] | ||
return root[SET] = adoptedSet | ||
let doc = root.ownerDocument || root, win = doc.defaultView | ||
if (!root.head && root.adoptedStyleSheets && win.CSSStyleSheet) { | ||
let adopted = adoptedSet.get(doc) | ||
if (adopted) { | ||
root.adoptedStyleSheets = [adopted.sheet, ...root.adoptedStyleSheets] | ||
return root[SET] = adopted | ||
} | ||
this.sheet = new CSSStyleSheet | ||
this.sheet = new win.CSSStyleSheet | ||
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets] | ||
adoptedSet = this | ||
adoptedSet.set(doc, this) | ||
} else { | ||
this.styleTag = (root.ownerDocument || root).createElement("style") | ||
this.styleTag = doc.createElement("style") | ||
let target = root.head || root | ||
@@ -99,0 +101,0 @@ target.insertBefore(this.styleTag, target.firstChild) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22774
391