From d6fa9285c16af6d63e2a4fe6b258dc41337a8b06 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 3 Jan 2014 06:56:27 -0800 Subject: [PATCH] Check for existence of partial template before parsing --- mustache.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mustache.js b/mustache.js index e1099b0..de8ec8f 100644 --- a/mustache.js +++ b/mustache.js @@ -496,9 +496,8 @@ break; case '>': if (!partials) continue; - var partialTemplate = isFunction(partials) ? partials(token[1]) : partials[token[1]]; - value = this.parse(partialTemplate); - if (value != null) buffer += this.renderTokens(value, context, partials, partialTemplate); + value = isFunction(partials) ? partials(token[1]) : partials[token[1]]; + if (value != null) buffer += this.renderTokens(this.parse(value), context, partials, value); break; case '&': value = context.lookup(token[1]);