31

The answer was "no" back in March 2010:

Browser EventListenerList Implementation

I'm wondering if there has been any progress since then.

If the answer's still "no" ... any indication of when any browser might support it?

1

1 Answer 1

32

For those looking for a practical solution, see: How to find event listeners on a DOM node when debugging or from the JavaScript code?


EventListenerList was in some old draft of DOM 3 Events and was long removed from the spec. As far as I know, at least Gecko still doesn't have anything like this for regular web pages, although it now has an API for privileged code (extensions) to enumerate listeners (see https://bugzilla.mozilla.org/show_bug.cgi?id=570678#c0).

I looked through the W3C mailing lists, and there were a few discussions on this topic, but apparently no use-cases were found to justify the feature. This is the most recent message I could find:

[...] what is the motivation for adding this functionality at all? Previously, the working group resolved to remove the related but less powerful hasEventListenerNS method for lack of a use case, and because there are potential security issues.

(2001) http://lists.w3.org/Archives/Public/w3c-wai-ua/2001OctDec/thread.html#msg89 has some discussion from way back when the EventListenerList was considered.

(2006) http://lists.w3.org/Archives/Public/www-archive/2006Mar/0032.html asks a question to the author of quirksmode who seems to be responsible for the DOM3 EventListenerList myth about the use cases of such a feature; the archives do not list a reply.

(2008) another discussion: http://lists.w3.org/Archives/Public/public-webapi/2008Apr/thread.html#msg66

Note: Commenting on my post is not a good way to provide feedback for the browser vendors and standards organizations. I'm not affiliated with either group, and I doubt they will see or act on the comments here..

8
  • 2
    It would be great with an update, if anybody is up to date with the status. Nowt it's 2015 :) Commented Jul 19, 2015 at 19:16
  • 3
    My use case is to clone an element and its event listeners. How is this not an obvious use case? Commented Aug 26, 2015 at 20:41
  • 7
    that's weird they couldn't find any use-case. if i'm debugging a situation where a event seems not to be attached, it'd be useful to see what events are attached. or if i have a mixin that attaches events, unless one already exists, in which case it defers to the existing event.
    – worc
    Commented Aug 7, 2016 at 1:10
  • 5
    One use case would be accessibility testing: flagging or warning about click events on inaccessible elements. Really wishing this hadn't been removed. Commented Oct 10, 2016 at 20:08
  • 10
    Another use case: I'm visiting a webpage that has an annoying event listener. I want to open my browser console and remove it. Or better yet, write a web extension that automatically removes this listener. Commented Jun 14, 2017 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.