From 2c26308490fe750415be2957bfa6cb23a85d6524 Mon Sep 17 00:00:00 2001 From: Frank Showalter <842058+fshowalter@users.noreply.github.com> Date: Sun, 8 Jun 2025 12:54:38 -0400 Subject: [PATCH 1/2] fix background-* spelling --- lib/properties/backgroundAttachment.js | 2 +- lib/properties/backgroundColor.js | 2 +- lib/properties/backgroundImage.js | 2 +- lib/properties/backgroundPosition.js | 2 +- lib/properties/backgroundRepeat.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/properties/backgroundAttachment.js b/lib/properties/backgroundAttachment.js index 360e51ba..db37e2c9 100644 --- a/lib/properties/backgroundAttachment.js +++ b/lib/properties/backgroundAttachment.js @@ -19,7 +19,7 @@ module.exports.definition = { v = parsers.prepareValue(v, this._global); if (parsers.hasVarFunc(v)) { this._setProperty("background", ""); - this._setProperty("backgound-attachemnt", v); + this._setProperty("background-attachemnt", v); } else { this._setProperty("background-attachment", module.exports.parse(v)); } diff --git a/lib/properties/backgroundColor.js b/lib/properties/backgroundColor.js index c4d38b26..fdb21cba 100644 --- a/lib/properties/backgroundColor.js +++ b/lib/properties/backgroundColor.js @@ -22,7 +22,7 @@ module.exports.definition = { v = parsers.prepareValue(v, this._global); if (parsers.hasVarFunc(v)) { this._setProperty("background", ""); - this._setProperty("backgound-color", v); + this._setProperty("background-color", v); } else { this._setProperty("background-color", module.exports.parse(v)); } diff --git a/lib/properties/backgroundImage.js b/lib/properties/backgroundImage.js index 5c48df90..c99a2491 100644 --- a/lib/properties/backgroundImage.js +++ b/lib/properties/backgroundImage.js @@ -18,7 +18,7 @@ module.exports.definition = { v = parsers.prepareValue(v, this._global); if (parsers.hasVarFunc(v)) { this._setProperty("background", ""); - this._setProperty("backgound-image", v); + this._setProperty("background-image", v); } else { this._setProperty("background-image", module.exports.parse(v)); } diff --git a/lib/properties/backgroundPosition.js b/lib/properties/backgroundPosition.js index 14d40f6d..80b9452c 100644 --- a/lib/properties/backgroundPosition.js +++ b/lib/properties/backgroundPosition.js @@ -39,7 +39,7 @@ module.exports.definition = { v = parsers.prepareValue(v, this._global); if (parsers.hasVarFunc(v)) { this._setProperty("background", ""); - this._setProperty("backgound-position", v); + this._setProperty("background-position", v); } else { this._setProperty("background-position", module.exports.parse(v)); } diff --git a/lib/properties/backgroundRepeat.js b/lib/properties/backgroundRepeat.js index 90c59977..b67b0c0c 100644 --- a/lib/properties/backgroundRepeat.js +++ b/lib/properties/backgroundRepeat.js @@ -19,7 +19,7 @@ module.exports.definition = { v = parsers.prepareValue(v, this._global); if (parsers.hasVarFunc(v)) { this._setProperty("background", ""); - this._setProperty("backgound-repeat", v); + this._setProperty("background-repeat", v); } else { this._setProperty("background-repeat", module.exports.parse(v)); } From 9f4d69e523637f80e943d92496678b70bd96b406 Mon Sep 17 00:00:00 2001 From: Frank Showalter <842058+fshowalter@users.noreply.github.com> Date: Mon, 9 Jun 2025 08:05:38 -0400 Subject: [PATCH 2/2] add regression test --- test/CSSStyleDeclaration.test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/CSSStyleDeclaration.test.js b/test/CSSStyleDeclaration.test.js index 67c12e7b..10ff5643 100644 --- a/test/CSSStyleDeclaration.test.js +++ b/test/CSSStyleDeclaration.test.js @@ -1100,3 +1100,17 @@ describe("regression test for https://github.com/jsdom/jsdom/issues/3021", () => assert.strictEqual(style.font, "bold 4px sans-serif"); }); }); + +describe("regression test for https://github.com/jsdom/cssstyle/issues/214", () => { + it("should return value for each property", () => { + const style = new CSSStyleDeclaration(); + const key = "background-color"; + const camel = "backgroundColor"; + const value = "var(--foo)"; + style[key] = value; + assert.strictEqual(style[key], value); + style[key] = null; + style[camel] = value; + assert.strictEqual(style[camel], value); + }); +});