Re: [whatwg/dom] Allow custom "get the parent" algorithms for EventTargets (#583)

In https://github.com/whatwg/dom/issues/1146 I suggested a method that could be available on `EventTarget`:

> It would be great to introduce _some kind of mechanism_ for EventTargets to associate with one another to allow for event bubbling and capturing. Perhaps `EventTarget` could have something like `associateAncestor(ancestorEventTarget, { capture: true, bubble: true })` which could do the necessary internal wiring to make an event targets event capture & bubble upward to an ancestor? Existing `EventTarget`s could throw when this is called, but it would allow for designs in userland to make use of a fairly large feature within `EventTarget`.

Having a method on the child event target allows it to perform necessary cleanup if called multiple times, and allows for customisation of the different phases. For example I can imagine some implementations opting out of the capturing phase and only allowing bubbling to occur.


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

Message ID: <whatwg/dom/issues/583/1403383897@github.com>

Received on Wednesday, 25 January 2023 10:19:17 UTC