Make the function passed to a block helper have an identical signature to top-level template methods
This commit is contained in:
@@ -627,13 +627,16 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
Handlebars.VM = {
|
||||
programWithDepth: function(fn) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
return function(context) {
|
||||
return function(context, helpers, partials, data) {
|
||||
args[0] = helpers || args[0];
|
||||
args[1] = partials || args[1];
|
||||
args[2] = data || args[2];
|
||||
return fn.apply(this, [context].concat(args));
|
||||
};
|
||||
},
|
||||
program: function(fn, helpers, partials, data) {
|
||||
return function(context) {
|
||||
return fn(context, helpers, partials, data);
|
||||
return function(context, h2, p2, d2) {
|
||||
return fn(context, h2 || helpers, p2 || partials, d2 || data);
|
||||
};
|
||||
},
|
||||
noop: function() { return ""; },
|
||||
|
||||
Reference in New Issue
Block a user