You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 4, 2019. It is now read-only.
This commit refactors the internal scope handling of templates so that
the concept of a scope, including block parameters, is rigorous. It also
stops leaking the caller's scope into a helper call.
This commit has two primary changes:
* The internal "scope" is now broken up into `self` and `locals`. Block
helpers now receive `options.template.yield`, which is used like
`options.template.yield([ optional, block, params ])`. If block
parameters are supplied, HTMLBars will ask the host to create a new
scope frame, and the `locals` hash will be populated with the yielded
parameters. It is still possible to shift the `self` by using
`options.template.render(newSelf, [ optional, block, params ])`,
which will always create a new scope frame. Since self-shifting
helpers are intended to be rare, `yield` is the new path, and
encapsulates all of the scoping details.
* Helpers and block helpers no longer receive the `self` as `this`,
because they are intended to be analogous to functions. Functions
do not have access to the scope of the caller O_o. Note that hooks,
which are used by the host to implement the scoping semantics,
of course still have access to the scope.
0 commit comments