Re: [whatwg/dom] [Proposal] Add EventTarget.getEventListeners() (#412)

Let me make sure I am understanding the current situation:

 - There are encapsulation concerns which people agrees with. Adding this API does remove a current (implicit) guarantee that "regular" code cannot access the already registered event listeners.
 - Domenic also raised another very good concern early on - this enables building APIs that rely on an event listener being registered already which is typically not a good design.
 - There seems to be consensus about the use cases Lea raised in the initial post being valid and common. There is also agreement that the current way to accomplish this by altering `EventTarget.prototype` is hacky and imperfect.
 - The idea of having an opt in or opt out for listeners being discoverable by `getEventListeners` has been raised. People seem to agree that having an opt-in reduces the usability of the feature.

What about an alternative "enable encapsulation" options like the ones browsers typically use to enable breaking features like `eval` e.g. a header that restores the "no `getEventListeners`" behavior or an opt-in behavior so most websites can benefit from this but ones who care about this encapsulation cannot?

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

Message ID: <whatwg/dom/issues/412/1063126716@github.com>

Received on Wednesday, 9 March 2022 16:43:33 UTC