Precise DOM morphing
morphing typescript dom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix morphing child nodes

It will now morph child nodes if either the from node or the to node have child nodes.

+2 -2
+1 -1
dist/morphlite.js
··· 17 17 if (from.tagName === to.tagName) { 18 18 if (from.attributes.length > 0 || to.attributes.length > 0) 19 19 morphAttributes(from, to); 20 - if (to.childNodes.length > 0) 20 + if (from.childNodes.length > 0 || to.childNodes.length > 0) 21 21 morphChildNodes(from, to, idMap); 22 22 } 23 23 else
+1 -1
src/morphlite.ts
··· 20 20 } else if (isElement(from) && isElement(to)) { 21 21 if (from.tagName === to.tagName) { 22 22 if (from.attributes.length > 0 || to.attributes.length > 0) morphAttributes(from, to); 23 - if (to.childNodes.length > 0) morphChildNodes(from, to, idMap); 23 + if (from.childNodes.length > 0 || to.childNodes.length > 0) morphChildNodes(from, to, idMap); 24 24 } else from.replaceWith(to.cloneNode(true)); 25 25 } else { 26 26 throw new Error(