Skip to content

Commit

Permalink
fix: patch up attribute comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Feb 4, 2023
1 parent 39cb438 commit 958234c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client/src/engine/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default class Dom {
Object.keys(diff[i].oldNode.attributes),
Object.keys(diff[i].newNode.attributes)
) &&
arraysMatch(
Object.values(diff[i].oldNode.attributes),
Object.values(diff[i].newNode.attributes)
) &&
diff[i].oldNode.innerHTML === diff[i].newNode.innerHTML
) {
continue;
Expand All @@ -35,6 +39,7 @@ export default class Dom {
);

if (hasDirectivePrefix || hasDirectiveShorthandPrefix) {
console.log('diffing reaches here...', diff[i]);
diff[i].oldNode.innerHTML = diff[i].newNode.innerHTML;

for (let j = 0; j < diff[i].newNode.attributes.length; j++) {
Expand All @@ -48,6 +53,13 @@ export default class Dom {
.includes(true)
)
) {
if (
diff[i].oldNode.getAttribute(attr.name) ===
attr.value
) {
diff[i].oldNode.setAttribute(attr.name, attr.value);
}

continue;
}

Expand Down

0 comments on commit 958234c

Please sign in to comment.