don't duplicate html on updates

This commit is contained in:
Leo Horie 2016-07-30 15:46:14 -04:00
parent 9bd0cd73fc
commit f4b267ff39
3 changed files with 6 additions and 5 deletions

View file

@ -216,7 +216,7 @@ module.exports = function($window) {
toFragment(old)
insertNode(parent, createHTML(vnode), nextSibling)
}
else vnode.dom = old.dom
else vnode.dom = old.dom, vnode.domSize = old.domSize
}
function updateFragment(parent, old, vnode, hooks, nextSibling, ns) {
updateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)
@ -356,7 +356,7 @@ module.exports = function($window) {
}
}
if (vnode.dom.parentNode != null) parent.removeChild(vnode.dom)
if (context != null && vnode.domSize == null && !hasIntegrationMethods(vnode.attrs) && typeof vnode.tag === "string") { //TODO test custom elements
if (context != null && vnode.domSize == null && !hasIntegrationMethods(vnode.attrs) && typeof vnode.tag === "string" && vnode.tag !== "<") { //TODO test custom elements
if (!context.pool) context.pool = [vnode]
else context.pool.push(vnode)
}

View file

@ -20,6 +20,7 @@ o.spec("updateHTML", function() {
render(root, [updated])
o(updated.dom).equals(root.firstChild)
o(updated.domSize).equals(1)
o(updated.dom.nodeValue).equals("b")
})
o("adds html", function() {