Re:Htmx and Web Components: A Perfect Match
by AndrewHampton on Thursday January 18, 2024 @08:17AM
(#39041297)
Another option would be for the B to dispatch a `CustomEvent` on itself. That event will bubble up the DOM until it hits A. A would then need an event listener that would probably stop propagation and do whatever bookkeeping is necessary.
[ Parent
| on HN ]
Re:Htmx and Web Components: A Perfect Match
by tomhallett on Thursday January 18, 2024 @09:15AM
(#39041898)
This seems like the best option, because it works just as well if the child components are loaded async (Ie: a tab component loading sub tabs on hover, and then the parent tab container needing to subscribe to that)