summaryrefslogtreecommitdiffstats
path: root/spec/javascript-compiler.js
diff options
context:
space:
mode:
authorMatthew Flaschen <mflaschen@wikimedia.org>2015-01-17 17:08:01 -0500
committerMatthew Flaschen <mflaschen@wikimedia.org>2015-01-17 19:04:38 -0500
commitc9d723e0fb18001273a076c6413c1f847812e508 (patch)
treecf7475035226adc8aa80db9b392550355a5cd4ab /spec/javascript-compiler.js
parentc5fe2527b393a1cc83948bdfd86b8b3783332eef (diff)
downloadhandlebars.js-c9d723e0fb18001273a076c6413c1f847812e508.zip
handlebars.js-c9d723e0fb18001273a076c6413c1f847812e508.tar.gz
handlebars.js-c9d723e0fb18001273a076c6413c1f847812e508.tar.bz2
Add missing reserved words so compiler knows to use array syntax:
* await * null * true * false IE 8 was failing to compile Handlebars-generated source code because it had helpers.null. I came up with this list by diffing https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords against the ones Handlebars already had. I added two corresponding tests for nameLookup.
Diffstat (limited to 'spec/javascript-compiler.js')
-rw-r--r--spec/javascript-compiler.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/javascript-compiler.js b/spec/javascript-compiler.js
index 4260567..fb78658 100644
--- a/spec/javascript-compiler.js
+++ b/spec/javascript-compiler.js
@@ -19,6 +19,12 @@ describe('javascript-compiler api', function() {
};
shouldCompileTo("{{foo}}", { bar_foo: "food" }, "food");
});
+
+ // Tests nameLookup dot vs. bracket behavior. Bracket is required in certain cases
+ // to avoid errors in older browsers.
+ it('should handle reserved words', function() {
+ shouldCompileTo("{{foo}} {{~null~}}", { foo: "food" }, "food");
+ });
});
describe('#compilerInfo', function() {
var $superCheck, $superInfo;