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

extra expression evaluation when using attributes #1590

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

extra expression evaluation when using attributes #1590

nippur72 opened this issue Feb 12, 2016 · 3 comments
Labels
Milestone

Comments

@nippur72
Copy link
Contributor

@nippur72 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
Copy link
Member

@GianlucaGuarini GianlucaGuarini commented Feb 12, 2016

this issue was already fixed in riot@next ;)

@GianlucaGuarini GianlucaGuarini added the bug label Feb 12, 2016
@GianlucaGuarini
Copy link
Member

@GianlucaGuarini GianlucaGuarini commented Feb 12, 2016

live demo using riot next

@nippur72
Copy link
Contributor Author

@nippur72 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.