Skip to content

Commit

Permalink
Use Text.data and check against the old value (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
brainkim committed Nov 10, 2020
1 parent cbf7c55 commit 5f6b3e9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ export class DOMRenderer extends Renderer<Node, string | undefined> {
i++;
} else if (typeof newChild === "string") {
if (oldChild.nodeType === Node.TEXT_NODE) {
oldChild.nodeValue = newChild;
if ((oldChild as Text).data !== newChild) {
(oldChild as Text).data = newChild;
}

oldChild = oldChild.nextSibling;
} else {
node.insertBefore(document.createTextNode(newChild), oldChild);
Expand Down

0 comments on commit 5f6b3e9

Please sign in to comment.