-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mustache: only the current context is passed to partials, instead of the full stack. #227
Comments
I think this behaviour is according to the Mustache spec (Partials section) isn't it? I think the trick that Handlebars did was not to allow referencing anything up the stack unless you use backtracking paths. Support for backtracking has been filed in #163. I am not sure if Handlebars can backtrack up the stack in a partial though. |
The spec doesn't seem to cover context nesting; it just says that a partial inherits the current context, but it also says the same for a section (which, in CanJS's Mustache, does inherit the stack). |
I think this makes sense if easy to implement. Sent from my iPhone On Jan 9, 2013, at 3:06 PM, "Brad (Bradley) Momberger" notifications@github.com wrote:
|
There is a lot that is specced in the Mustache spec definition files that isn't listed on their site: https://github.com/mustache/spec Sections are specced to pass contexts, but partials aren't. Regardless, good idea so I added support. :) |
http://jsfiddle.net/TYe6A/
It makes template organization a hassle, since I can't just take a subsection out of template and move it into a partial if it's calling anything up the stack.
I believe this is because when partials are called in can/view/mustache, the value of CONTEXT_STACK.pop() is sent as the object to render. Would it be feasible to send in all of the stack?
The text was updated successfully, but these errors were encountered: