Socket
Socket
Sign inDemoInstall

style-mod

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-mod - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

2

package.json
{
"name": "style-mod",
"version": "2.2.2",
"version": "2.2.3",
"description": "A minimal CSS module shim",

@@ -5,0 +5,0 @@ "main": "dist/style-mod.cjs",

@@ -70,9 +70,19 @@ function sym(name, random) {

let adoptedSet = null
class StyleSet {
constructor(root) {
this.root = root
root[SET] = this
this.styleTag = (root.ownerDocument || root).createElement("style")
let target = root.head || root
target.insertBefore(this.styleTag, target.firstChild)
if (root.adoptedStyleSheets && typeof CSSStyleSheet != "undefined") {
if (adoptedSet) {
root.adoptedStyleSheets = [adoptedSet.sheet].concat(root.adoptedStyleSheets)
return root[SET] = adoptedSet
}
this.sheet = new CSSStyleSheet
root.adoptedStyleSheets = [this.sheet].concat(root.adoptedStyleSheets)
adoptedSet = this
} else {
this.styleTag = (root.ownerDocument || root).createElement("style")
let target = root.head || root
target.insertBefore(this.styleTag, target.firstChild)
}
this.modules = []

@@ -82,3 +92,3 @@ }

mount(modules) {
let sheet = this.styleTag.sheet, reset = !sheet
let sheet = this.sheet
let pos = 0 /* Current rule offset */, j = 0 /* Index into this.modules */

@@ -94,3 +104,3 @@ for (let i = 0; i < modules.length; i++) {

this.modules.splice(j++, 0, mod)
if (!reset) for (let k = 0; k < mod[RULES].length; k++)
if (sheet) for (let k = 0; k < mod[RULES].length; k++)
sheet.insertRule(mod[RULES][k], pos++)

@@ -104,3 +114,3 @@ } else {

if (reset) {
if (!sheet) {
let text = ""

@@ -123,3 +133,3 @@ for (let i = 0; i < this.modules.length; i++)

} else if (/&/.test(prop)) {
renderStyle(prop.replace(/&/g, selector), spec[prop], output)
renderStyle(selector.split(/\s*,\s*/).map(sel => prop.replace(/&/g, sel)).join(", "), spec[prop], output)
} else if (prop != "specificity") {

@@ -126,0 +136,0 @@ if (typeof spec[prop] == "object") throw new RangeError("The value of a property (" + prop + ") should be a primitive value.")

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc