| @@ -515,9 +515,10 @@ var Mustache = function() { | |||||
| return 'text'; | return 'text'; | ||||
| case 'endSection': | case 'endSection': | ||||
| var section = parserContext.stack.pop(); | |||||
| var section = parserContext.stack[parserContext.stack.length-1]; | |||||
| if (--section.depth === 0) { | if (--section.depth === 0) { | ||||
| if (section.key === key) { | if (section.key === key) { | ||||
| parserContext.stack.pop(); | |||||
| this.commandSet.section.call(this, section.sectionType, | this.commandSet.section.call(this, section.sectionType, | ||||
| section.content, | section.content, | ||||
| key, | key, | ||||
| @@ -533,8 +534,6 @@ var Mustache = function() { | |||||
| } else { | } else { | ||||
| section.content.push('{{', '/', key, '}}'); | section.content.push('{{', '/', key, '}}'); | ||||
| parserContext.stack.push(section); | |||||
| return 'endSectionScan'; | return 'endSectionScan'; | ||||
| } | } | ||||
| default: | default: | ||||