diff options
author | kpdecker <kpdecker@gmail.com> | 2013-01-13 23:43:29 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-01-13 23:43:29 -0600 |
commit | 24fc3a2288d788488e056cbaa0f13503e2607e1b (patch) | |
tree | ed8a6513710e2e17b93ff145bcf093fd8972f209 | |
parent | 8961298859c42b3158dba7fa40b716cd2d63ef98 (diff) | |
download | handlebars.js-24fc3a2288d788488e056cbaa0f13503e2607e1b.zip handlebars.js-24fc3a2288d788488e056cbaa0f13503e2607e1b.tar.gz handlebars.js-24fc3a2288d788488e056cbaa0f13503e2607e1b.tar.bz2 |
Prevent write on all depth variables
-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'); }); |