use reverse loop with deletions

This commit is contained in:
Leo Horie 2014-05-01 22:39:52 -04:00
parent 42a33b074c
commit f28ae323c5
8 changed files with 9 additions and 7 deletions

View file

@ -161,7 +161,7 @@ Mithril = m = new function app(window) {
return cachedAttrs
}
function clear(nodes) {
for (var i = 0; i < nodes.length; i++) nodes[i].parentNode.removeChild(nodes[i])
for (var i = nodes.length - 1; i > -1; i--) nodes[i].parentNode.removeChild(nodes[i])
nodes.length = 0
}
function injectHTML(parentElement, index, data) {