Prevent write on all depth variables
This commit is contained in:
@@ -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
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user