🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

jsdom

Package Overview
Dependencies
Maintainers
6
Versions
285
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdom - npm Package Compare versions

Comparing version
29.0.2
to
29.1.0
+4
-1
lib/jsdom/living/css/CSSGroupingRule-impl.js

@@ -15,3 +15,5 @@ "use strict";

insertRule(rule, index) {
return this.cssRules._insert(rule, index, this._isInNestingContext(), this, this.parentStyleSheet);
const result = this.cssRules._insert(rule, index, this._isInNestingContext(), this, this.parentStyleSheet);
this.parentStyleSheet?.ownerNode?._ownerDocument._clearStyleCache();
return result;
}

@@ -21,2 +23,3 @@

this.cssRules._remove(index);
this.parentStyleSheet?.ownerNode?._ownerDocument._clearStyleCache();
}

@@ -23,0 +26,0 @@

+7
-1

@@ -40,3 +40,5 @@ "use strict";

return this.cssRules._insertParsed(parsed, index, null, this);
const result = this.cssRules._insertParsed(parsed, index, null, this);
this.ownerNode?._ownerDocument._clearStyleCache();
return result;
}

@@ -49,2 +51,3 @@

this.cssRules._remove(index);
this.ownerNode?._ownerDocument._clearStyleCache();
}

@@ -86,2 +89,4 @@

cssParser.parseIntoStyleSheet(text, this._globalObject, this);
this.ownerNode?._ownerDocument._clearStyleCache();
}

@@ -113,2 +118,3 @@

this.#disallowModification = false;
this.ownerNode?._ownerDocument._clearStyleCache();

@@ -115,0 +121,0 @@ // webidl2js doesn't auto-wrap return values: https://github.com/jsdom/webidl2js/issues/257

@@ -264,12 +264,5 @@ "use strict";

function invalidateStyleCache(elementImpl) {
if (elementImpl._attached) {
elementImpl._ownerDocument._styleCache = new WeakMap();
}
}
exports.SHADOW_DOM_PSEUDO_REGEXP = /^::(?:part|slotted)\(/i;
exports.getComputedStyleDeclaration = getComputedStyleDeclaration;
exports.getInheritedPropertyValue = getInheritedPropertyValue;
exports.invalidateStyleCache = invalidateStyleCache;
exports.replaceEmptyValueAndKeywords = replaceEmptyValueAndKeywords;

@@ -30,2 +30,3 @@ "use strict";

PERCENTAGE: "Percentage",
RATIO: "Ratio",
STRING: "String",

@@ -443,2 +444,20 @@ URL: "Url"

/**
* Serializes a <ratio> value.
*
* @param {Array<object>} val - The AST value.
* @returns {string|undefined} The serialized ratio.
*/
function serializeRatio(val) {
const res = parseNumericValue(
val,
{ max: Number.INFINITY, min: 0 },
type => type === AST_TYPES.NUMBER
);
if (!res) {
return undefined;
}
return `${res.num} / 1`;
}
/**
* Serializes a <url> value.

@@ -815,4 +834,5 @@ *

exports.serializePercentage = serializePercentage;
exports.serializeRatio = serializeRatio;
exports.serializeString = serializeString;
exports.serializeURL = serializeURL;
exports.splitValue = splitValue;

@@ -41,3 +41,4 @@ "use strict";

number: numberType,
percentage: percentageType
percentage: percentageType,
ratio: ratioType
} = dimensionTypes;

@@ -80,2 +81,4 @@ const { color: colorType, image: imageType, paint: paintType } = functionTypes;

val = parsers.serializePercentage(parsedValue, percentageType);
} else if (ratioType) {
val = parsers.serializeRatio(parsedValue, ratioType);
}

@@ -82,0 +85,0 @@ this._setProperty(property, val, priority);

@@ -5,3 +5,2 @@ "use strict";

const { parseStyleSheet, parseIntoStyleSheet } = require("./css-parser");
const { invalidateStyleCache } = require("./computed-style");

@@ -58,3 +57,3 @@ // TODO: this should really implement https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet

invalidateStyleCache(elementImpl);
elementImpl._ownerDocument._clearStyleCache();

@@ -117,3 +116,3 @@ sheet.parentStyleSheet = null;

invalidateStyleCache(elementImpl);
elementImpl._ownerDocument._clearStyleCache();

@@ -120,0 +119,0 @@ // TODO: title and disabled stuff

@@ -215,2 +215,6 @@ "use strict";

_clearStyleCache() {
this._styleCache = new WeakMap();
}
// The `DOMSelector` instance is lazily created, as it is somewhat expensive to create and not always needed.

@@ -217,0 +221,0 @@ _getDOMSelector() {

@@ -22,3 +22,2 @@ "use strict";

} = require("../helpers/shadow-dom");
const { invalidateStyleCache } = require("../css/helpers/computed-style");

@@ -244,7 +243,11 @@ function nodeEquals(a, b) {

this._clearMemoizedQueries();
invalidateStyleCache(this);
if (this._attached) {
this._ownerDocument._clearStyleCache();
}
}
_childTextContentChangeSteps() {
invalidateStyleCache(this);
if (this._attached) {
this._ownerDocument._clearStyleCache();
}
}

@@ -251,0 +254,0 @@

{
"name": "jsdom",
"version": "29.0.2",
"version": "29.1.0",
"description": "A JavaScript implementation of many web standards",

@@ -26,6 +26,6 @@ "keywords": [

"dependencies": {
"@asamuzakjp/css-color": "^5.1.5",
"@asamuzakjp/dom-selector": "^7.0.6",
"@asamuzakjp/css-color": "^5.1.11",
"@asamuzakjp/dom-selector": "^7.1.1",
"@bramus/specificity": "^2.4.2",
"@csstools/css-syntax-patches-for-csstree": "^1.1.1",
"@csstools/css-syntax-patches-for-csstree": "^1.1.3",
"@exodus/bytes": "^1.15.0",

@@ -37,8 +37,8 @@ "css-tree": "^3.2.1",

"is-potential-custom-element-name": "^1.0.1",
"lru-cache": "^11.2.7",
"parse5": "^8.0.0",
"lru-cache": "^11.3.5",
"parse5": "^8.0.1",
"saxes": "^6.0.0",
"symbol-tree": "^3.2.4",
"tough-cookie": "^6.0.1",
"undici": "^7.24.5",
"undici": "^7.25.0",
"w3c-xmlserializer": "^5.0.0",

@@ -62,8 +62,8 @@ "webidl-conversions": "^8.0.1",

"@webref/css": "^8.5.0",
"eslint": "^10.0.3",
"eslint": "^10.2.1",
"eslint-plugin-html": "^8.1.4",
"eslint-plugin-n": "^17.24.0",
"globals": "^17.4.0",
"globals": "^17.5.0",
"js-yaml": "^4.1.1",
"minimatch": "^10.2.4",
"minimatch": "^10.2.5",
"mocha": "^11.7.5",

@@ -70,0 +70,0 @@ "mocha-sugar-free": "^1.4.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display