-
Notifications
You must be signed in to change notification settings - Fork 422
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.stache is returning incorrect values for DOM attributes #1065
Comments
I think this issue could be related to #1063 |
@robregonm Yes, these do appear to be the same issue. This is true of all DOM attributes it seems as well, not just class. We've marked this for 2.1.2, so we'll have a fix asap. |
Are you sure those are related? #1063 is in Mustache and this appears only in Stache. |
This bug already causes simple things like <h2 class="{{#if shown}}foo{{/if}} test1 {{#shown}}muh{{/shown}}"></h2>
<h3 class="{{#if shown}}bar{{/if}} test2 {{#shown}}kuh{{/shown}}"></h3>
<h4 class="{{#if shown}}baz{{/if}} test3 {{#shown}}boom{{/shown}}"></h4> To fail, filling in the wrong subsections due to evaluator caching in https://github.com/bitovi/canjs/blob/master/view/stache/mustache_core.js#L419 (as pointed out in the Todo the line before). I recommend removing the caching - unless @justinbmeyer has another idea - since subsections are almost always different (except for the visual benchmark). It will slow the visual benchmark performance down from ~3.9ms to ~7.6ms. |
Truthy statements such as: {{#foo}}bar{{/foo}} are correctly calculated, except when within a DOM element's attribute(such as class). In that case, only the last .fn() or .inverse() is returned.
http://jsfiddle.net/f2Zwm/1/
The text was updated successfully, but these errors were encountered: