extra expression evaluation when using attributes #1590

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

Projects

None yet

2 participants

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

this issue was already fixed in riot@next ;)

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

live demo using riot next

@nippur72
Contributor

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