don't move element if not needed

This commit is contained in:
Leo Horie 2016-08-11 00:28:03 -04:00
parent c4a710e61c
commit 9d38c12630

View file

@ -140,7 +140,7 @@ module.exports = function($window) {
if (o === v) oldEnd--, start++ if (o === v) oldEnd--, start++
else if (o != null && v != null && o.key === v.key) { else if (o != null && v != null && o.key === v.key) {
updateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), recycling, ns) updateNode(parent, o, v, hooks, getNextSibling(old, oldEnd + 1, nextSibling), recycling, ns)
insertNode(parent, toFragment(o), getNextSibling(old, oldStart, nextSibling)) if (start < end) insertNode(parent, toFragment(o), getNextSibling(old, oldStart, nextSibling))
oldEnd--, start++ oldEnd--, start++
} }
else break else break
@ -516,10 +516,7 @@ module.exports = function($window) {
var active = $doc.activeElement var active = $doc.activeElement
// First time rendering into a node clears it out // First time rendering into a node clears it out
if (dom.vnodes == null) { if (dom.vnodes == null) dom.textContent = ""
dom.vnodes = []
dom.textContent = "";
}
if (!(vnodes instanceof Array)) vnodes = [vnodes] if (!(vnodes instanceof Array)) vnodes = [vnodes]
updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, undefined) updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, undefined)