Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 11
    This method won't work if you're writing a user script or content script. Not only are likely to be sandboxed these days but how can you guarantee the order of execution? Commented Jul 25, 2011 at 8:22
  • 13
    Couldn't you just modify Node.prototype instead? That's where HTMLAnchorElement inherits .addEventListener from anyways.' Commented Jun 16, 2012 at 6:48
  • 6
    You're assuming that the user agent implements prototype inheritance for DOM host objects and allows you to modify them. Neither of those are good ideas: don't modify objects you don't own. Commented Nov 13, 2012 at 0:43
  • 1
    This is pretty useless - it shows what eventListeners were added, which can be good in some cases, but not what was removed. So if you are trying to debug what was removed and what wasn't, there is simply no way. Commented Sep 15, 2015 at 10:46
  • 1
    @IvanCastellanos What I meant was that your lastListenerInfo array contains only the listeners that were added. OP asked for which event listeners are observing a particular DOM node, which includes the ones that were removed. If you'd have overwritten removeEventListener the same you did with addEventListener your lastListenerInfo array would have exactly what OP asked for (although he was talking about input and select elements, not anchors, but whatever). Commented Feb 21, 2016 at 1:12