diff options
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 2 | ||||
-rw-r--r-- | spec/qunit_spec.js | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 97e8c91..48a3db5 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -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(); } diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index f16949e..526c397 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -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'); }); |