diff --git a/packages/moon/dist/moon.js b/packages/moon/dist/moon.js index c5f6210f..1ab86639 100644 --- a/packages/moon/dist/moon.js +++ b/packages/moon/dist/moon.js @@ -1176,9 +1176,9 @@ var nodeNew = executeComponent(nodesNew.pop()); // If they have the same reference (hoisted) then skip diffing. if (nodeOldNode !== nodeNew) { - if (nodeOldNode.name !== nodeNew.name) { - // If they have different names, then replace the old node with the - // new one. + if (nodeOldNode.type !== nodeNew.type || nodeOldNode.name !== nodeNew.name) { + // If they have different types or names, then replace the old node + // with the new one. patches.push({ type: patchTypes.replaceNode, nodeOld: nodeOld, diff --git a/packages/moon/dist/moon.min.js b/packages/moon/dist/moon.min.js index acbb235a..ac81f2a0 100644 --- a/packages/moon/dist/moon.min.js +++ b/packages/moon/dist/moon.min.js @@ -4,4 +4,4 @@ * Released under the MIT License * https://kbrsh.github.io/moon */ -!function(e,t){"undefined"==typeof module?e.Moon=t():module.exports=t()}(this,function(){"use strict";var S={element:0,text:1,component:2};function w(e,t){return void 0===e?t:e}var N,D=/^\s+$/,A=/<([\w\d-_]+)([^>]*?)(\/?)>/g,t=/"[^"]*"|'[^']*'|\d+[a-zA-Z$_]\w*|\.[a-zA-Z$_]\w*|[a-zA-Z$_]\w*:|([a-zA-Z$_]\w*)/g,C=/&|>|<| |"|\\|"|\n|\r/g,n=["NaN","false","in","null","this","true","typeof","undefined","window"],P={class:"className",for:"htmlFor"},q={"&":"&",">":">","<":"<"," ":" ",""":'\\"',"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"};function L(e){var a=!0;return{value:e.replace(t,function(e,t){return void 0===t||-1!==n.indexOf(t)?e:(a=!1,"$"===t[0]?t:"data."+t)}),isStatic:a}}function a(e){e=e.trim();for(var t=[],a=0;a",a+2),i=e.slice(a+2,o);0,t.push({type:"tagClose",value:i}),a=o+1;continue}if("!"===r&&"-"===e[a+2]&&"-"===e[a+3]){var l=e.indexOf("--\x3e",a+4);0,a=l+3;continue}A.lastIndex=a;var d=A.exec(e);0;for(var u=d[0],v=d[1],s=d[2],f=d[3],c={},p=0;p]*?)(\/?)>/g,t=/"[^"]*"|'[^']*'|\d+[a-zA-Z$_]\w*|\.[a-zA-Z$_]\w*|[a-zA-Z$_]\w*:|([a-zA-Z$_]\w*)/g,C=/&|>|<| |"|\\|"|\n|\r/g,n=["NaN","false","in","null","this","true","typeof","undefined","window"],P={class:"className",for:"htmlFor"},q={"&":"&",">":">","<":"<"," ":" ",""":'\\"',"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"};function L(e){var a=!0;return{value:e.replace(t,function(e,t){return void 0===t||-1!==n.indexOf(t)?e:(a=!1,"$"===t[0]?t:"data."+t)}),isStatic:a}}function a(e){e=e.trim();for(var t=[],a=0;a",a+2),i=e.slice(a+2,o);0,t.push({type:"tagClose",value:i}),a=o+1;continue}if("!"===r&&"-"===e[a+2]&&"-"===e[a+3]){var l=e.indexOf("--\x3e",a+4);0,a=l+3;continue}A.lastIndex=a;var d=A.exec(e);0;for(var u=d[0],v=d[1],s=d[2],f=d[3],c={},p=0;p