From 34b3ef9e97fa01307671bde7914c561ef2632b01 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Wed, 21 May 2014 22:56:38 -0400 Subject: [PATCH] fix double removals --- mithril.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mithril.js b/mithril.js index a2a841c5..9b204fac 100644 --- a/mithril.js +++ b/mithril.js @@ -53,6 +53,7 @@ Mithril = m = new function app(window) { cached[cacheCount++] = item } if (!intact) { + if (nodes.length < cached.nodes.length) cached.nodes = cached.nodes.filter(function(node) {return node.parentNode !== null}) for (var i = 0; i < data.length; i++) if (cached[i] !== undefined) nodes = nodes.concat(cached[i].nodes) for (var i = nodes.length, node; node = cached.nodes[i]; i++) if (node.parentNode !== null) node.parentNode.removeChild(node) for (var i = cached.nodes.length, node; node = nodes[i]; i++) if (node.parentNode === null) parentElement.appendChild(node)