Skip to content

Commit

Permalink
Don't update unchanged dom attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Feb 13, 2025
1 parent 1104149 commit 3893e2b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions datex-bindings/dom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,16 @@ export class DOMUtils {

// normal attribute
else {
if (val === false) element.removeAttribute(attr);
else if (val === true) element.setAttribute(attr, "");
else element.setAttribute(attr, this.formatAttributeValue(val, root_path, element));
if (val === false) {
if (element.hasAttribute(attr)) element.removeAttribute(attr);
}
else if (val === true) {
if (!element.hasAttribute(attr)) element.setAttribute(attr, "");
}
else {
const newValue = this.formatAttributeValue(val, root_path, element);
if (element.getAttribute(attr) !== newValue) element.setAttribute(attr, newValue);
}
}


Expand Down

0 comments on commit 3893e2b

Please sign in to comment.