diff options
Diffstat (limited to 'lib/handlebars/runtime.js')
-rw-r--r-- | lib/handlebars/runtime.js | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index b47d961..55eb1c1 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -38,9 +38,6 @@ export function template(templateSpec, env) { function invokePartialWrapper(partial, context, options) { if (options.hash) { context = Utils.extend({}, context, options.hash); - if (options.ids) { - options.ids[0] = true; - } } partial = env.VM.resolvePartial.call(this, partial, context, options); @@ -132,7 +129,7 @@ export function template(templateSpec, env) { function ret(context, options = {}) { let data = options.data; - ret._setup(options); + _setup(options); if (!options.partial && templateSpec.useData) { data = initData(context, data); } @@ -140,7 +137,7 @@ export function template(templateSpec, env) { blockParams = templateSpec.useBlockParams ? [] : undefined; if (templateSpec.useDepths) { if (options.depths) { - depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; + depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; } else { depths = [context]; } @@ -154,7 +151,7 @@ export function template(templateSpec, env) { } ret.isTop = true; - ret._setup = function(options) { + function _setup(options) { if (!options.partial) { container.helpers = container.merge(options.helpers, env.helpers); @@ -169,25 +166,15 @@ export function template(templateSpec, env) { container.partials = options.partials; container.decorators = options.decorators; } - }; - - ret._child = function(i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new Exception('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new Exception('must pass parent depths'); - } + } - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; return ret; } export function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { function prog(context, options = {}) { let currentDepths = depths; - if (depths && context !== depths[0]) { + if (depths && context != depths[0]) { currentDepths = [context].concat(depths); } @@ -224,9 +211,6 @@ export function resolvePartial(partial, context, options) { export function invokePartial(partial, context, options) { options.partial = true; - if (options.ids) { - options.data.contextPath = options.ids[0] || options.data.contextPath; - } let partialBlock; if (options.fn && options.fn !== noop) { |