summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/handlebars/compiler/compiler.js9
-rw-r--r--lib/handlebars/runtime.js7
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index be17ac3..7acff1f 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -453,10 +453,17 @@ export function compile(input, options, env) {
}
// Template is only compiled on first use and cached after that point.
- return function(context, options) {
+ var ret = function(context, options) {
if (!compiled) {
compiled = compileInput();
}
return compiled.call(this, context, options);
};
+ ret.child = function(i) {
+ if (!compiled) {
+ compiled = compileInput();
+ }
+ return compiled.child(i);
+ };
+ return ret;
}
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index 9974c71..b179620 100644
--- a/lib/handlebars/runtime.js
+++ b/lib/handlebars/runtime.js
@@ -97,7 +97,7 @@ export function template(templateSpec, env) {
compilerInfo: templateSpec.compiler
};
- return function(context, options) {
+ var ret = function(context, options) {
options = options || {};
var namespace = options.partial ? options : env,
helpers,
@@ -119,6 +119,11 @@ export function template(templateSpec, env) {
}
return templateSpec.main.call(container, context, helpers, partials, data);
};
+
+ ret.child = function(i) {
+ return container.programWithDepth(i);
+ };
+ return ret;
}
export function programWithDepth(i, data /*, $depth */) {