Skip to content

Commit

Permalink
only change textcontent if node with single textnode changed (perf bo…
Browse files Browse the repository at this point in the history
…ost)
  • Loading branch information
kbrsh committed Feb 23, 2017
1 parent 2353bbb commit 9c99001
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
var currentChildNode = node.firstChild;
// Optimization:
// If the vnode contains just one text vnode, create it here
if (vnode.children.length === 1 && vnode.children[0].type === "#text" && currentChildNode && !currentChildNode.nextSibling && currentChildNode.nodeName === "#text") {
if (vnode.children.length === 1 && vnode.children[0].type === "#text" && currentChildNode && !currentChildNode.nextSibling && currentChildNode.nodeName === "#text" && vnode.children[0].val !== currentChildNode.textContent) {
currentChildNode.textContent = vnode.children[0].val;
} else {
// Iterate through all children
Expand Down
Loading

0 comments on commit 9c99001

Please sign in to comment.