Skip to content
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

can.Observe.prototype.each overrides {{#each}} Mustache helper. #258

Merged
merged 2 commits into from
Mar 25, 2013

Conversation

daffl
Copy link
Contributor

@daffl daffl commented Mar 25, 2013

In Mustache.get (can/view/mustache/mustache.js line 822 in current HEAD) prototype functions and data members of the context object override Mustache helpers. This causes the "each" helper to be unavailable when using a can.Observe, since its prototype includes "each", and an exception is thrown due to the two functions having different type signatures.

@ghost ghost assigned daffl Feb 25, 2013
@daffl
Copy link
Contributor

daffl commented Mar 13, 2013

I'm assuming that helper should always have priority right?

@justinbmeyer
Copy link
Contributor

I bet the specification has something to say about this.

If not, I'm not sure the helper would have higher priority. It might be more expensive to change a bunch of item's property names than to alias a helper.

@bmomberger-reciprocity
Copy link
Contributor Author

https://github.com/wycats/handlebars.js/blob/master/spec/qunit_spec.js#L1019
"helpers take precedence over same-named context properties"
"Scoped names [e.g. 'this.foo'] take precedence over helpers"

daffl added a commit that referenced this pull request Mar 25, 2013
can.Observe.prototype.each overrides {{#each}} Mustache helper.
@daffl daffl merged commit d33de3f into master Mar 25, 2013
@daffl daffl deleted the mustache-helper-priority-258 branch March 25, 2013 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants