From 9e5a50e5c882b8a5863799574c6ecdf5b27621e7 Mon Sep 17 00:00:00 2001 From: thegrandpoobah Date: Mon, 31 Jan 2011 17:28:55 -0500 Subject: [PATCH] Don't use function call for token so that activation context doesn't have to be created. --- mustache.js | 76 +++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/mustache.js b/mustache.js index 35f3f0d..6bf4694 100644 --- a/mustache.js +++ b/mustache.js @@ -146,7 +146,7 @@ var Mustache = function() { createParserContext: function(tokens, partials, openTag, closeTag) { return { tokens: tokens, - token: function() { return this.tokens[this.index]; }, + token: tokens[0], index: 0, length: tokens.length, partials: partials, @@ -185,15 +185,7 @@ var Mustache = function() { regex = this._createTokenizerRegex(openTag, closeTag); } - var tokens = this.splitFunc.call(template, regex); - var cleaned_tokens = []; - for (var i = 0, n = tokens.length; i