From 4466a475615f26d763e2962471cf8f048da08662 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 19 May 2010 13:26:53 +0200 Subject: [PATCH] whoopsiedupecode --- mustache.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mustache.js b/mustache.js index 61f6ad2..3c0191d 100644 --- a/mustache.js +++ b/mustache.js @@ -18,10 +18,12 @@ var Mustache = function() { context: {}, render: function(template, context, partials, in_recursion) { - // reset buffer - // TODO: make this non-lazy - if(!in_recursion) - this.buffer = []; + // reset buffer & set context + if(!in_recursion) { + this.context = context; + this.buffer = []; // TODO: make this non-lazy + } + // fail fast if(!this.includes("", template)) { if(in_recursion) { @@ -32,11 +34,6 @@ var Mustache = function() { } } - if(!in_recursion) { - this.context = context; - this.buffer = []; - } - template = this.render_pragmas(template); var html = this.render_section(template, context, partials); if(in_recursion) {