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

Closed
alexisabril opened this Issue Jun 10, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@alexisabril
Contributor

alexisabril commented Jun 10, 2014

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/

@daffl daffl added this to the 2.1.2 milestone Jun 11, 2014

@robregonm

This comment has been minimized.

Show comment
Hide comment
@robregonm

robregonm Jun 11, 2014

I think this issue could be related to #1063

I think this issue could be related to #1063

@alexisabril

This comment has been minimized.

Show comment
Hide comment
@alexisabril

alexisabril Jun 11, 2014

Contributor

@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.

Contributor

alexisabril commented Jun 11, 2014

@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.

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Jun 11, 2014

Contributor

Are you sure those are related? #1063 is in Mustache and this appears only in Stache.

Contributor

daffl commented Jun 11, 2014

Are you sure those are related? #1063 is in Mustache and this appears only in Stache.

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Jun 12, 2014

Contributor

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.

Contributor

daffl commented Jun 12, 2014

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.

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