- From: Carlos Lopez <notifications@github.com>
- Date: Mon, 30 Jan 2023 08:09:42 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 30 January 2023 16:09:55 UTC
About two years later, I better understand @rniwa 's point about GC complexity.
A class that extends `EventTarget` *can* have a getter setter related to getting the parent. The `Node` (class) implementation can return `Node.prototype.parentNode`. That allows our (authors') extensions of EventTarget to handle the tree ourselves along with removal and concerns about GC (I'd probably use WeakRef internally). Implementers (Apple/FireFox coders) just have to invoke the getter and that's it.
If that's the right idea, let me know and I can write up a proposal draft. Something like
````js
class MyCustomEventTarget extends EventTarget {
/** @override */
get parentEventTarget() {
return AUTHOR_EVENTTARGET_WEAKMAP.get(this);
}
````
IIRC, bubbling and capture are part of composedPath which shouldn't need any extra code other than a "get the parent" function/getter.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/583#issuecomment-1408894882
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/583/1408894882@github.com>
Received on Monday, 30 January 2023 16:09:55 UTC