From 27d3f73de1061a37e4d521f8b8cbdc5e232366a2 Mon Sep 17 00:00:00 2001 From: thegrandpoobah Date: Tue, 1 Feb 2011 11:52:46 -0500 Subject: [PATCH] Another stack push/pop optimization --- mustache.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mustache.js b/mustache.js index 8a50a78..8a9d85c 100644 --- a/mustache.js +++ b/mustache.js @@ -515,9 +515,10 @@ var Mustache = function() { return 'text'; case 'endSection': - var section = parserContext.stack.pop(); + var section = parserContext.stack[parserContext.stack.length-1]; if (--section.depth === 0) { if (section.key === key) { + parserContext.stack.pop(); this.commandSet.section.call(this, section.sectionType, section.content, key, @@ -533,8 +534,6 @@ var Mustache = function() { } else { section.content.push('{{', '/', key, '}}'); - parserContext.stack.push(section); - return 'endSectionScan'; } default: