From 858e8069ab8b7acb3609eba444d66b0652793d2c Mon Sep 17 00:00:00 2001 From: Kabir Shah Date: Fri, 19 May 2017 18:21:28 -0700 Subject: [PATCH] set children when clearing in optimization by reference to retain for next diff --- dist/moon.js | 2 +- dist/moon.min.js | 2 +- src/util/vdom.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/moon.js b/dist/moon.js index 8f13ba6a..7dc09f31 100644 --- a/dist/moon.js +++ b/dist/moon.js @@ -865,7 +865,7 @@ while ((firstChild = _node.firstChild) !== null) { removeChild(firstChild, _node); } - oldChildren = []; + oldVNode.children = []; } } else { // Traverse and Diff Children diff --git a/dist/moon.min.js b/dist/moon.min.js index fa057b0c..f9486939 100644 --- a/dist/moon.min.js +++ b/dist/moon.min.js @@ -4,4 +4,4 @@ * Released under the MIT License * http://moonjs.ga */ -!function(e,t){"object"==typeof module&&module.exports?module.exports=t():e.Moon=t()}(this,function(){"use strict";function e(e){this.instance=e,this.cache={},this.setters={},this.clear={},this.target=null,this.map={}}function t(t){this.$opts=t||{};var r=this;this.$id=a++,this.$name=this.$opts.name||"root",this.$data=this.$opts.data||{},this.$render=this.$opts.render||b,this.$hooks=this.$opts.hooks||{};var n=this.$opts.methods;void 0!==n&&s(r,n),this.$events={},this.$dom={},this.$observer=new e(this),this.$destroyed=!0,this.$queued=!1;var i=this.$opts.computed;void 0!==i&&l(this,i),this.init()}var r={},n={},i={},o={stop:"event.stopPropagation();",prevent:"event.preventDefault();",ctrl:"if(!event.ctrlKey) {return;};",shift:"if(!event.shiftKey) {return;};",alt:"if(!event.altKey) {return;};",enter:"if(event.keyCode !== 13) {return;};"},a=0,s=function(e,t){for(var r in t)!function(t,r){e.$data[t]=function(){return r.apply(e,arguments)}}(r,t[r])},l=function(e,t){for(var r in t)!function(r){var n=e.$observer;n.observe(r),Object.defineProperty(e.$data,r,{get:function(){var i=null;return void 0===n.cache[r]?(n.target=r,i=t[r].get.call(e),n.target=null,n.cache[r]=i):i=n.cache[r],i},set:b});var i=null;void 0!==(i=t[r].set)&&(n.setters[r]=i)}(r)};e.prototype.observe=function(e){var t=this;this.clear[e]=function(){t.cache[e]=void 0}},e.prototype.notify=function(e,t){var r=null;if(void 0!==(r=this.map[e]))for(var n=0;nc?u:c,f=0,d=0;f"===o||" "===o)break;i+=o,n++}var a={type:"tag",value:i};return e.tokens.push(a),e.current=n,a},U=function(e,t){for(var r=t.input,n=r.length,i=t.current,o=r.charAt(i),a=r.charAt(i+1),s=function(){i++,o=r.charAt(i),a=r.charAt(i+1)},l={};i"!==o&&("/"!==o||">"!==a);)if(" "!==o){for(var u="",c=!1;i"===o||"/"===o||">"===a){c=!0;break}u+=o,s()}var v={name:u,value:"",meta:{}};if(c)l[u]=v;else{s();var p=" ";for("'"!==o&&'"'!==o||(p=o,s());i1&&(a=c.shift(),u=c.join("(").slice(0,-1),H(u,i));for(var v="",p=0;pc?u:c,f=0,d=0;f"===o||" "===o)break;i+=o,n++}var a={type:"tag",value:i};return e.tokens.push(a),e.current=n,a},U=function(e,t){for(var r=t.input,n=r.length,i=t.current,o=r.charAt(i),a=r.charAt(i+1),s=function(){i++,o=r.charAt(i),a=r.charAt(i+1)},l={};i"!==o&&("/"!==o||">"!==a);)if(" "!==o){for(var u="",c=!1;i"===o||"/"===o||">"===a){c=!0;break}u+=o,s()}var v={name:u,value:"",meta:{}};if(c)l[u]=v;else{s();var p=" ";for("'"!==o&&'"'!==o||(p=o,s());i1&&(a=c.shift(),u=c.join("(").slice(0,-1),H(u,i));for(var v="",p=0;p