Precise DOM morphing
morphing typescript dom
0
fork

Configure Feed

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

Fix removing attributes

Previously, it would only morph attributes when the `to` node had attributes on it.

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