summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-01-19 21:18:21 -0600
committerkpdecker <kpdecker@gmail.com>2014-02-09 22:48:38 -0600
commitc72a8d5e844bf94d048630396b27728826e1b1a1 (patch)
tree9328b7ecd2469ec512262df26fcf1b5ce13e29a7 /lib/handlebars/compiler/compiler.js
parentd00d8b677616ebafce70d93b9149c11a1d78842c (diff)
downloadhandlebars.js-c72a8d5e844bf94d048630396b27728826e1b1a1.zip
handlebars.js-c72a8d5e844bf94d048630396b27728826e1b1a1.tar.gz
handlebars.js-c72a8d5e844bf94d048630396b27728826e1b1a1.tar.bz2
Add child accessor API
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js9
1 files changed, 8 insertions, 1 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;
}