From f441791324268dcf4fd15022b7ca760d0abd5b49 Mon Sep 17 00:00:00 2001 From: Kabir Shah Date: Fri, 5 May 2017 23:47:49 -0700 Subject: [PATCH] simplify createNodeFromVNode by using existing appendChild utility --- dist/moon.js | 9 ++------- dist/moon.min.js | 2 +- src/util/dom.js | 9 ++------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/dist/moon.js b/dist/moon.js index c4af238f..36790285 100644 --- a/dist/moon.js +++ b/dist/moon.js @@ -376,18 +376,13 @@ } else { // Add all children for (var i = 0; i < vnode.children.length; i++) { - var childVNode = vnode.children[i]; - var childNode = createNodeFromVNode(vnode.children[i], instance); - el.appendChild(childNode); - // Component detected, mount it here - if (childVNode.meta.component !== undefined) { - createComponentFromVNode(childNode, childVNode, childVNode.meta.component); - } + appendChild(createNodeFromVNode(vnode.children[i], instance), vnode.children[i], el); } } // Add all event listeners addEventListeners(el, vnode, instance); } + // Setup Props diffProps(el, {}, vnode, vnode.props.attrs); diff --git a/dist/moon.min.js b/dist/moon.min.js index c1b018f3..86dc70b4 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;nu?l:u,v=0,f=0;v"===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 p={name:u,value:"",meta:{}};if(c)l[u]=p;else{s();var v=" ";for("'"!==o&&'"'!==o||(v=o,s());i1&&(a=c.shift(),u=c.join("(").slice(0,-1),H(u,i));for(var p="",v=0;vu?l:u,v=0,f=0;v"===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 p={name:u,value:"",meta:{}};if(c)l[u]=p;else{s();var v=" ";for("'"!==o&&'"'!==o||(v=o,s());i1&&(a=c.shift(),u=c.join("(").slice(0,-1),H(u,i));for(var p="",v=0;v