diff --git a/public/src/templates.js b/public/src/templates.js index 02fabee079..f2833c68d1 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -155,7 +155,7 @@ block = template.replace(new RegExp("[\\s\\S]*[\r\n]*([\\s\\S]*?)[\r\n]*[\\s\\S]*", 'g'), '$1'); - if (typeof block === "undefined") { + if (typeof block === "undefined" || !array[key].length) { return template; } @@ -255,7 +255,7 @@ continue; } else if (obj[key] === null) { template = replace(template, namespace + key, ''); - } else if (obj[key].constructor === Array && obj[key].length) { + } else if (obj[key].constructor === Array) { template = parseArray(template, obj, key, namespace + key + '.', bind); } else if (obj[key] instanceof Object) { defineParent(obj[key], originalObj); @@ -283,7 +283,7 @@ // clean up all undefined conditionals template = setBindContainer(template.replace(/\s*\s*/gi, 'ENDIF -->\r\n') .replace(/\s*/gi, '') - .replace(/\s*/gi, '') + .replace(/\s*/gi, '') .replace(/\s*\s*/gi, ''), bind); template = setBindContainer(template, bind);