The problem I am trying to solve hers is the showEventTooltip action. I’d prefer not do a lot of DOM traversing based on event.currentTarget, but I am not sure if there is another way. Ideally, I’d be able to provide a ‘context’ to a DOM node, which would allow me to sort-of “scope” my actions and targets.
<div class="timeline__layer__event timeline__layer__event--range"
<div class="timeline__layer__event__content" data-target="event.foo">
Pie is yummy.
Approaches that I can think of so far:
Create a separate controller for events. This feels like an easy solution, but also feels a bit weird because you’d quickly end up creating lots of controllers for everything.
Use generated actions and targets so that they are unique
I’d love to hear how other people are solving this issue and whether there is a way to make this work.
I’m not totally clear on the problem. Could you share what your action looks like? Is the issue that you want to read those data attributes from a parent element of the current target and treat them like arguments or parameters for the action?