Makes Handlebars work in contexts without a global object (node)

This commit is contained in:
wycats
2011-02-08 14:31:09 -08:00
parent 4d501b6613
commit aaaafb4400
+2 -2
View File
@@ -345,7 +345,7 @@ Handlebars.JavaScriptCompiler = function() {};
this.source.push("return buffer;"); this.source.push("return buffer;");
var params = ["context", "helpers", "partials"]; var params = ["Handlebars", "context", "helpers", "partials"];
for(var i=0, l=this.environment.depths.list.length; i<l; i++) { for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
params.push("depth" + this.environment.depths.list[i]); params.push("depth" + this.environment.depths.list[i]);
@@ -366,7 +366,7 @@ Handlebars.JavaScriptCompiler = function() {};
return function(context, helpers, partials, depth) { return function(context, helpers, partials, depth) {
try { try {
return container.render.apply(container, arguments); return container.render.call(container, Handlebars, context, helpers, partials, depth);
} catch(e) { } catch(e) {
throw e; throw e;
} }