Open JaneOri opened 5 years ago
stache syntax could be interesting. like:
<ul on:delegated:click=".clickme; doSomething()">
<li>asdf</li>
<li class="clickme">Hi</li>
<li class="clickme">Hello</li>
</ul>
downside: any existing event delegation to direct children of the component element can't use this since the component element isn't part of the view.
@James0x57
Could set this up with the connectedCallback
- e.g.
connectedCallback( element ) {
this.listenTo( element, ".delegated", "click", event => {
// ...
});
});
Except registering delegated listeners currently does not work correctly at all with the underlying event bindings mixin. See also my findings in https://github.com/canjs/can-event-queue/issues/35
Since can-component
events
deprecated: https://canjs.com/doc/can-component.prototype.events.html There isn't a happy path solution for the DOM event delegation that it provided