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
Milestone

Comments

@nippur72
Copy link
Contributor

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

this issue was already fixed in riot@next ;)

@GianlucaGuarini
Copy link
Member

live demo using riot next

@nippur72
Copy link
Contributor Author

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
Development

No branches or pull requests

2 participants