Skip to content

Commit

Permalink
Re-do the recent performance fix
Browse files Browse the repository at this point in the history
180cab1 removed unnecessary access to the cssText property when there is no onChange callback provided. However, 1f5940b undid that gain by saving the original value for later comparison.
  • Loading branch information
domenic committed Dec 28, 2023
1 parent cb8296e commit 3148f84
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/CSSStyleDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ CSSStyleDeclaration.prototype = {
this.removeProperty(name);
return;
}
var originalText = this.cssText;

var originalText;
if (this._onChange) {
originalText = this.cssText;
}

if (this._values[name]) {
// Property already exist. Overwrite it.
var index = Array.prototype.indexOf.call(this, name);
Expand Down

0 comments on commit 3148f84

Please sign in to comment.