postcss-selector-parser
Advanced tools
+4
-0
@@ -0,1 +1,5 @@ | ||
| # 7.1.4 - 2026-06-11 | ||
| - fix: tolerate non-node children when serializing selectors | ||
| # 7.1.3 - 2026-06-11 | ||
@@ -2,0 +6,0 @@ |
@@ -417,4 +417,15 @@ "use strict"; | ||
| Container.prototype._stringify = function (options, depth, max) { | ||
| return this.map(function (child) { return child._stringify(options, depth, max); }).join(""); | ||
| var _this = this; | ||
| return this.map(function (child) { return _this._stringifyChild(child, options, depth, max); }).join(""); | ||
| }; | ||
| // Serialize a child node. Historically `toString` used `this.map(String)`, | ||
| // which leniently coerced anything — including raw arrays inserted via | ||
| // `replaceWith(array)` / `insertBefore` / `insertAfter` (e.g. Tailwind's | ||
| // `:merge()` expansion). Fall back to `String(child)` for values that are not | ||
| // parser nodes so that behaviour is preserved. | ||
| Container.prototype._stringifyChild = function (child, options, depth, max) { | ||
| return typeof child._stringify === "function" | ||
| ? child._stringify(options, depth, max) | ||
| : String(child); | ||
| }; | ||
| return Container; | ||
@@ -421,0 +432,0 @@ }(node_1.default)); |
@@ -31,2 +31,3 @@ "use strict"; | ||
| Pseudo.prototype._stringify = function (options, depth, max) { | ||
| var _this = this; | ||
| if (depth >= max) { | ||
@@ -36,3 +37,5 @@ throw new Error("Cannot serialize selector: nesting depth exceeds the maximum of ".concat(max, ".")); | ||
| var params = this.length | ||
| ? "(" + this.map(function (child) { return child._stringify(options, depth + 1, max); }).join(",") + ")" | ||
| ? "(" + | ||
| this.map(function (child) { return _this._stringifyChild(child, options, depth + 1, max); }).join(",") + | ||
| ")" | ||
| : ""; | ||
@@ -39,0 +42,0 @@ return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join(""); |
@@ -31,4 +31,5 @@ "use strict"; | ||
| Root.prototype._stringify = function (options, depth, max) { | ||
| var _this = this; | ||
| var str = this.reduce(function (memo, selector) { | ||
| memo.push(selector._stringify(options, depth, max)); | ||
| memo.push(_this._stringifyChild(selector, options, depth, max)); | ||
| return memo; | ||
@@ -35,0 +36,0 @@ }, []).join(","); |
+1
-1
| { | ||
| "name": "postcss-selector-parser", | ||
| "description": "Selector parser with built in methods for working with selector strings.", | ||
| "version": "7.1.3", | ||
| "version": "7.1.4", | ||
| "devDependencies": { | ||
@@ -6,0 +6,0 @@ "oxfmt": "^0.54.0", |
212373
0.39%4058
0.37%