This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25593 - Access to event listeners in the EventTarget
Summary: Access to event listeners in the EventTarget
Status: RESOLVED INVALID
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-07 22:22 UTC by Arkadiusz Michalski (Spirit)
Modified: 2014-05-08 09:58 UTC (History)
3 users (show)

See Also:


Attachments

Description Arkadiusz Michalski (Spirit) 2014-05-07 22:22:03 UTC
Any plans do this in the future? It would be useful if we have access to all registered event listeners from context:

el.eventListeners << return some array

And we can loop through this array, get single event listener (read type, callback, capture with the possibility of changes and one method to remove this event listener totally).

If it is completely impossible maybe add to the EventTarget some method to remove all event listeners. Now its not easy... especially when we have a lot of them and some have anonymous callback. We must clone only context, move content, and probably reconstruction some listeners (nothing pleasant).

I just wonder if there any chances of a better API for these things or we must use some additional libraries/tricks.
Comment 1 Anne 2014-05-08 09:58:31 UTC
We don't really want to make listeners observable. There's various places in the platform where this has happened anyway, but I'm not planning on giving in just yet.

As for a better API, I suggest you discuss that on www-dom@w3.org. This is not really a place for brainstorming.