Re: [whatwg/dom] Event delegation via EventListenerOptions (#215)

It's on my goals for this quarter (so, next week) to prototype a spec and tests for this. Unlike the other EventTarget stuff I've been taking on, I'm not sure I understand all the subtleties here fully, so help would be appreciated. Let me try to summarize what I think is the current best plan:

- A new `matches` option (or `delegate` option? `delegateSelector`? `filter`? #bikeshedtime) that takes a selector
- A new `ignoreBubbles` boolean option that defaults to true when `matches` is provided
- `event.currentTarget` and the `this` value get redefined/changed when delegation is involved, to be "the object on event's propagation path for which callbacks are currently being invoked", which is apparently a generalization of the current definition.
- A new `event.delegateTarget` property which is defined the way `event.currentTarget` is currently defined
- The exact filtering process is as explained in https://github.com/whatwg/dom/issues/215#issuecomment-213980467 option (1); this may be slow, and will require prototyping in browsers to see if it's doable. Notably, this version is not as simple as just checking if the target matches the selector.

Does this seem reasonable?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/215#issuecomment-310783925

Received on Friday, 23 June 2017 22:10:33 UTC