Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qstufie committed Feb 26, 2016
1 parent c1af388 commit 77d9852
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/simple.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions dist/simple.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 77d9852

Please sign in to comment.