ractivejs / ractive

Next-generation DOM manipulation
http://ractive.js.org
MIT License
5.94k stars 396 forks source link

Context.hasListener is not working inside another component #3251

Closed ceremcem closed 6 years ago

ceremcem commented 6 years ago

Description:

I would expect both mycomp detect their hello handler:

<mycomp on-hello="there">This has a listener</mycomp>
<something>
  <mycomp on-hello="there">This has a listener</mycomp>
</something>

Which outputs: image

Where the problem is that the one inside something component (inside dashed div) can not detect its hello handler.

Versions affected:

0.10.3

Reproduction

Playground

dagnelies commented 6 years ago

As a comment, using a simple <div><mycomp on-hello="there">This has a listener</mycomp></div> will not work either.

evs-chris commented 6 years ago

I poked at it a bit, and it looks like there may be a bug with instance contexts immediately inside of a yield - it is finding the div from the context above inside the something rather than the mycomp. I'm not 100% sure though, as I'll have to noodle out the meaning of the nested contexts in the yield, as those can be a bit confusing from the code side.

evs-chris commented 6 years ago

This is now fixed in 0.10.4. Thanks for the report!