From 77d9852736f2094f48ab9b9990b7affa3d8f8908 Mon Sep 17 00:00:00 2001 From: Bruce Date: Fri, 26 Feb 2016 23:28:33 +1100 Subject: [PATCH] bug fix --- dist/simple.dev.js | 2 +- dist/simple.min.js | 12 ++++++------ src/app.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/simple.dev.js b/dist/simple.dev.js index 15ce4f4..39a43a7 100644 --- a/dist/simple.dev.js +++ b/dist/simple.dev.js @@ -589,7 +589,7 @@ app = function (name, cnf) { // figure out the type (from template._type) var data = this.data[elName] || {}, state = this.state[elName] || '', output = ''; - if (typeof this.template.sub[elName] != 'object' || (oie(data) && this.cnf.skipEmptyData === true)) { + if (typeof this.template.sub[elName] != 'object' || oie(data)) { console.log('[Warning] No element template found or empty data for ' + elName); // decide whether to remove it from parent... if (this.cnf.partialRender && !forceRender) { diff --git a/dist/simple.min.js b/dist/simple.min.js index dac14a7..d4cb644 100644 --- a/dist/simple.min.js +++ b/dist/simple.min.js @@ -54,7 +54,7 @@ if(t===!0&&(this.pData={}),!n(this.data)&&h(this.pData)!=h(this.data)){var s=n(t for(var r in this.template.sub){var o=this.renderElement(r,s) o&&(i[r]=o)}(s||!n(i))&&(this.container.innerHTML=this.htpl(e,i)),this.pState=l(this.state),this.pData=l(this.data),this._f("drd")}},this.renderElement=function(t,e){e=e===!0 var i=this.data[t]||{},a=this.state[t]||"",r="" -if("object"!=typeof this.template.sub[t]||n(i)&&this.cnf.skipEmptyData===!0){if(this.cnf.partialRender&&!e){var o=this.node(t) +if("object"!=typeof this.template.sub[t]||n(i)){if(this.cnf.partialRender&&!e){var o=this.node(t) if(o)return o.parentNode.removeChild(o),!1}return""}var c=this.getCallback("rde",t) if("function"==typeof c)return c(a,i) if(h(this.data[t])==h(this.pData[t]))return!1 @@ -70,12 +70,12 @@ if(d.cnf.partialRender&&!e){var u=v-1,m=d.pData[t].element[u],y=d.data[t].elemen if(h(m)==h(y))return var S=d.node(t+"_"+v) g||(g=S.parentNode),b=d.htpl(c,f) -var k -g&&(S?b&&(k=new s(b,g),k.replace(S)):g&&(k=new s(b,g),k.right()))}else r+=d.htpl(c,f)}),g&&y.length>u.length&&y.map(function(e,i){if(i>=v){var a=d.node(t+"_"+i) +var _ +g&&(S?b&&(_=new s(b,g),_.replace(S)):g&&(_=new s(b,g),_.right()))}else r+=d.htpl(c,f)}),g&&y.length>u.length&&y.map(function(e,i){if(i>=v){var a=d.node(t+"_"+i) a&&g.removeChild(a)}}),!("string"==typeof r&&r.length>1))return!1 -r=d.htpl(p._wrapper[0],f)+r+p._wrapper[1]}else{var b=this.els(t,a,i),S=this.template.sub[t][b],k=this.parseElementData(t,a,i,p._type) -S||(S=this.template.sub[t]["default"]),r=this.htpl(S,k)}if(this.template.sub[t]._sibling){var _=this.node(this.template.sub[t]._sibling) -if(_){var w=new s(r,_.parentNode) +r=d.htpl(p._wrapper[0],f)+r+p._wrapper[1]}else{var b=this.els(t,a,i),S=this.template.sub[t][b],_=this.parseElementData(t,a,i,p._type) +S||(S=this.template.sub[t]["default"]),r=this.htpl(S,_)}if(this.template.sub[t]._sibling){var k=this.node(this.template.sub[t]._sibling) +if(k){var w=new s(r,k.parentNode) return w.right(),!1}}if(!e&&this.cnf.partialRender===!0&&r){var C=this.node(t),E=null if(C)return E=new s(r),E.replace(C),!1}return r},this.init=function(t,e){t&&(this.container=t),this.load(),e!==!1&&(this._f("sta"),this.render(),this._f("fin"))},this.toQuerystring=function(){var t=[] for(var e in this.state){var i=this.state[e] diff --git a/src/app.js b/src/app.js index 128f03a..7041658 100644 --- a/src/app.js +++ b/src/app.js @@ -588,7 +588,7 @@ app = function (name, cnf) { // figure out the type (from template._type) var data = this.data[elName] || {}, state = this.state[elName] || '', output = ''; - if (typeof this.template.sub[elName] != 'object' || (oie(data) && this.cnf.skipEmptyData === true)) { + if (typeof this.template.sub[elName] != 'object' || oie(data)) { console.log('[Warning] No element template found or empty data for ' + elName); // decide whether to remove it from parent... if (this.cnf.partialRender && !forceRender) {