diff options
Diffstat (limited to 'lib/handlebars/base.js')
-rw-r--r-- | lib/handlebars/base.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js index 7d6c1ce..776ba50 100644 --- a/lib/handlebars/base.js +++ b/lib/handlebars/base.js @@ -72,7 +72,8 @@ Handlebars.registerHelper('blockHelperMissing', function(context, fn, inverse) { return fn(context); }); -Handlebars.registerHelper('each', function(context, fn, inverse) { +Handlebars.registerHelper('each', function(ctx, fn, inverse) { + var context = typeof ctx == "function" ? ctx.call(this) : ctx; var ret = ""; if(context && context.length > 0) { @@ -98,7 +99,8 @@ Handlebars.registerHelper('unless', function(context, fn, inverse) { Handlebars.helpers['if'].call(this, context, inverse, fn); }); -Handlebars.registerHelper('with', function(context, fn) { +Handlebars.registerHelper('with', function(ctx, fn) { + var context = typeof ctx == "function" ? ctx.call(this) : ctx; return fn(context); }); |