summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
authorKevin Decker <kpdecker@gmail.com>2014-08-15 02:07:24 -0500
committerKevin Decker <kpdecker@gmail.com>2014-08-15 02:07:24 -0500
commitcf343a19495f92aba19111441f974588c835e735 (patch)
tree5d7a235783f73e67575fdd30f59df4d4e9d9d9a8 /lib/handlebars/compiler/javascript-compiler.js
parent2f14fa57e55d3089bc71aab3e08dc36a293cbc57 (diff)
parent3ce105ae894b328b4da5a4cf5ad80026aee42489 (diff)
downloadhandlebars.js-cf343a19495f92aba19111441f974588c835e735.zip
handlebars.js-cf343a19495f92aba19111441f974588c835e735.tar.gz
handlebars.js-cf343a19495f92aba19111441f974588c835e735.tar.bz2
Merge pull request #849 from wycats/helper-undefined
Fix undefined handling for pathed lookups
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index d9c23ee..a6930f0 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -377,10 +377,9 @@ JavaScriptCompiler.prototype = {
for (; i < len; i++) {
this.replaceStack(function(current) {
var lookup = this.nameLookup(current, parts[i], 'context');
- // We want to ensure that zero and false are handled properly for the first element
- // of non-chained elements, if the context (falsy flag) needs to have the special
- // handling for these values.
- if (!falsy && !i && len === 1) {
+ // We want to ensure that zero and false are handled properly if the context (falsy flag)
+ // needs to have the special handling for these values.
+ if (!falsy) {
return ' != null ? ' + lookup + ' : ' + current;
} else {
// Otherwise we can use generic falsy handling