diff --git a/packages/moon/dist/moon.js b/packages/moon/dist/moon.js index 67e07e63..04d31271 100644 --- a/packages/moon/dist/moon.js +++ b/packages/moon/dist/moon.js @@ -1104,11 +1104,11 @@ break; case "dataset": - delete element.dataset[key]; + delete element.dataset[setKey]; break; default: - element.style[key] = ""; + element.style[setKey] = ""; } } } @@ -1536,7 +1536,7 @@ case patchTypes.replaceNode: { // Replace an old element with a new one. - patch.elementParent.replaceChild(patch.elementOld, patch.elementNew); + patch.elementParent.replaceChild(patch.elementNew, patch.elementOld); break; } diff --git a/packages/moon/dist/moon.min.js b/packages/moon/dist/moon.min.js index 9a1c451e..caac5eb8 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 P={element:0,text:1,component:2};function d(e,t,a){this.node=e,this.element=t,this.children=a}function v(e,t,a,n){this.type=e,this.name=t,this.data=a,this.children=n}function S(e,t){return void 0===e?t:e}function n(e,t,a,n){return new v(e,t,a,n)}var s,N=/^\s+$/,A=/<([\w\d-_]+)([^>]*?)(\/?)>/g,t=/"[^"]*"|'[^']*'|\d+[a-zA-Z$_]\w*|\.[a-zA-Z$_]\w*|[a-zA-Z$_]\w*:|([a-zA-Z$_]\w*)/g,M=/&|>|<| |"|\\|"|\n|\r/g,r=["NaN","false","in","null","this","true","typeof","undefined","window"],C={class:"className",for:"htmlFor"},O={"&":"&",">":">","<":"<"," ":" ",""":'\\"',"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"};function q(e){var a=!0;return{value:e.replace(t,function(e,t){return void 0===t||-1!==r.indexOf(t)?e:(a=!1,"$"===t[0]?t:"children"===t?"mc":"md."+t)}),isStatic:a}}function a(e){e=e.trim();for(var t=[],a=0;a",a+2),l=e.slice(a+2,i);0,t.push({type:"tagClose",value:l}),a=i+1;continue}if("!"===r&&"-"===e[a+2]&&"-"===e[a+3]){var o=e.indexOf("--\x3e",a+4);0,a=o+3;continue}A.lastIndex=a;var u=A.exec(e);0;for(var v=u[0],s=u[1],d=u[2],c=u[3],f={},p=0;p]*?)(\/?)>/g,t=/"[^"]*"|'[^']*'|\d+[a-zA-Z$_]\w*|\.[a-zA-Z$_]\w*|[a-zA-Z$_]\w*:|([a-zA-Z$_]\w*)/g,M=/&|>|<| |"|\\|"|\n|\r/g,r=["NaN","false","in","null","this","true","typeof","undefined","window"],C={class:"className",for:"htmlFor"},O={"&":"&",">":">","<":"<"," ":" ",""":'\\"',"\\":"\\\\",'"':'\\"',"\n":"\\n","\r":"\\r"};function q(e){var a=!0;return{value:e.replace(t,function(e,t){return void 0===t||-1!==r.indexOf(t)?e:(a=!1,"$"===t[0]?t:"children"===t?"mc":"md."+t)}),isStatic:a}}function a(e){e=e.trim();for(var t=[],a=0;a",a+2),l=e.slice(a+2,i);0,t.push({type:"tagClose",value:l}),a=i+1;continue}if("!"===r&&"-"===e[a+2]&&"-"===e[a+3]){var o=e.indexOf("--\x3e",a+4);0,a=o+3;continue}A.lastIndex=a;var u=A.exec(e);0;for(var v=u[0],s=u[1],d=u[2],c=u[3],f={},p=0;p { - assertExecute([0], [0]); -}); +// Replace +for (let i of [2, 3, 5]) { + for (let j of [2, 3, 5]) { + test(`[${i}] -> [${j}]`, () => { + assertExecute([i], [j]); + }); + } +} + +// Append +for (let i of [2, 3, 5]) { + for (let j of [2, 3, 5]) { + const before = [i]; + const after = [j, j + 1, j + 2, j + 3, j * 2]; + + test(`[${before.toString()}] -> [${after.toString()}]`, () => { + assertExecute(before, after); + }); + } +} + +// Remove +for (let i of [2, 3, 5]) { + for (let j of [2, 3, 5]) { + const before = [i, i + 1, i + 2, i + 3, i * 2]; + const after = [j]; + + test(`[${before.toString()}] -> [${after.toString()}]`, () => { + assertExecute(before, after); + }); + } +}