Prevent write on all depth variables

This commit is contained in:
kpdecker
2013-01-13 23:43:29 -06:00
parent 8961298859
commit 24fc3a2288
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -897,7 +897,7 @@ Handlebars.JavaScriptCompiler = function() {};
item = callback.call(this, stack);
// Prevent modification of the context depth variable. Through replaceStack
if (this.compileStack.length <= 1) {
if (/^depth/.test(stack)) {
stack = this.nextStack();
}
+2 -2
View File
@@ -1289,8 +1289,8 @@ test('GH-408: Multiple loops fail', function() {
{ name: "Jane Doe", location: { city: "New York"} }
];
var template = CompilerContext.compile('{{#.}}{{name}}{{/.}}{{#.}}{{name}}{{/.}}');
var template = CompilerContext.compile('{{#.}}{{name}}{{/.}}{{#.}}{{name}}{{/.}}{{#.}}{{name}}{{/.}}');
var result = template(context);
equals(result, "John DoeJane DoeJohn DoeJane Doe", 'It should output twice');
equals(result, "John DoeJane DoeJohn DoeJane DoeJohn DoeJane Doe", 'It should output multiple times');
});