all repos — h3 @ e63031ac32b65abf66ee22a38ea7f58b1f3db211

A tiny, extremely minimalist JavaScript microframework.

Fixed redraw problem if child text node is substituted with a non-text node.
h3rald h3rald@h3rald.com
Tue, 28 Apr 2020 10:06:24 +0200
commit

e63031ac32b65abf66ee22a38ea7f58b1f3db211

parent

d9bed655aa4256d701e68a80976bcae4afb47aee

1 files changed, 4 insertions(+), 9 deletions(-)

jump to
M h3.jsh3.js

@@ -426,15 +426,10 @@ if (equal(newmap, oldmap) && (notFoundInNew >= 0 || notFoundInOld >= 0)) {

// Something changed for (let i = 0; i < newmap.length; i++) { if (newmap[i] === -1) { - if (oldvnode.children[i].type === "#text") { - oldvnode.children[i] = newvnode.children[i]; - node.childNodes[i].nodeValue = newvnode.children[i].value; - } else { - oldvnode.children[i].redraw({ - node: node.childNodes[i], - vnode: newvnode.children[i], - }); - } + oldvnode.children[i].redraw({ + node: node.childNodes[i], + vnode: newvnode.children[i], + }); } } } else {