add current context only search for mustache #226

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

RocHo commented Jun 28, 2012

This feature solves my project problem about using recursive template.Both parent node and child nodes has same property name ,when child node does not have that property(or null value),template will search parent property,this cause a recursive reference problem. Use ".children" to force search only with current context,not continue searching parent context.

Collaborator

dasilvacontin commented Dec 20, 2014

What about variable clashing with other children keys?

@dasilvacontin It isn't blessing a children key, this is actually an implementation of mustache/spec#52

Collaborator

dasilvacontin commented Dec 20, 2014

@bobthecow, oh, I see. This totally makes sense. Sorry for the confusion, I was going through a lot of old issues.

We still don't have this in mustache.js then? I have to check.

@dasilvacontin dasilvacontin reopened this Dec 20, 2014

Collaborator

dasilvacontin commented Dec 20, 2014

I'll investigate if this is a breaking change or not, to know if it will be incorporated in v1 or in a posterior version.

It's mostly not a breaking change, but it's also not in the spec. That issue I linked weighs both sides of that. Mustache.php hasn't shipped it (yet) because it's technically not spec compliant (see bobthecow/mustache.php#129).

That said, any spec-compliant Mustache implementation would render {{.foo}} as an empty string, since there's no way that context lookup works. So it shouldn't be a backwards compatibility break, as no user would be using tags like this in the wild.

Collaborator

dasilvacontin commented Dec 20, 2014

This will need a Chore issue for discussing, then. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment