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

extra expression evaluation when using attributes #1590

Closed
nippur72 opened this Issue Feb 12, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@nippur72
Contributor

nippur72 commented Feb 12, 2016

In the following tags, if I define "test" as <test someattr="a"> and not just <test>, something is wrong because the function foof() gets evaluated an additional time with the wrong context (this=test instead of this=main):

<test someattr="a">
  <div>hello <yield /></div>
  this.foof = function() { console.error("called from <test>!!"); return true; };  
</test>  

<main>
  <test if="{foof()}">someone</test>
  this.foof = function() { console.log("called from <main>"); return true; };  
</main>           

the console output is:

called from <main>
called from <main>
called from <main>
called from <main>
called from <test>!!         <--- extra call from wrong context
called from <main>

The plunker reproducing the bug is here. Try to drop someattr="a" to see normal behavior.

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini Feb 12, 2016

Member

this issue was already fixed in riot@next ;)

Member

GianlucaGuarini commented Feb 12, 2016

this issue was already fixed in riot@next ;)

@GianlucaGuarini GianlucaGuarini added the bug label Feb 12, 2016

@GianlucaGuarini

This comment has been minimized.

Show comment
Hide comment
@GianlucaGuarini

GianlucaGuarini Feb 12, 2016

Member

live demo using riot next

Member

GianlucaGuarini commented Feb 12, 2016

live demo using riot next

@nippur72

This comment has been minimized.

Show comment
Hide comment
@nippur72

nippur72 Feb 12, 2016

Contributor

great, thanks!

Contributor

nippur72 commented Feb 12, 2016

great, thanks!

@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Mar 9, 2016

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