From 55a381ef60201b59309b7c9b88bf1eccc4ee6caf Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Mon, 1 Dec 2025 14:39:11 +0100 Subject: [PATCH] set cssText: avoid serializing cssText when not needed --- lib/CSSStyleDeclaration.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CSSStyleDeclaration.js b/lib/CSSStyleDeclaration.js index a451cf9e..6d430623 100644 --- a/lib/CSSStyleDeclaration.js +++ b/lib/CSSStyleDeclaration.js @@ -391,7 +391,7 @@ Object.defineProperties(CSSStyleDeclaration.prototype, { return; } let originalText = ""; - if (typeof this._onChange === "function") { + if (typeof this._onChange === "function" && !this._setInProgress) { originalText = this.cssText; } if (this._values.has(property)) { @@ -414,8 +414,8 @@ Object.defineProperties(CSSStyleDeclaration.prototype, { this._values.set(property, val); if ( typeof this._onChange === "function" && - this.cssText !== originalText && - !this._setInProgress + !this._setInProgress && + this.cssText !== originalText ) { this._onChange(this.cssText); }