2

For debugging purpose and memory leak, I'd like to have the full list of registered event handlers. There's this nice visual tool but a plain text list would be welcomed.

Cheers.

Marc Polizzi
  • 9,137
  • 3
  • 32
  • 60
  • 1
    Possible dupe: http://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node – karim79 Jun 01 '11 at 15:56

1 Answers1

3

As the mentioned link says, there is no JavaScript API to retrieve all registered listeners. So, for testing purposes you might try overriding the EventTarget.prototype.addEventListener/removeEventListener methods and storing their arguments in your own storage to inspect later.

On a similar note, you can use the Chrome Developer Tools to examine currently registered listeners for a particular node (or the node chain up to the document root) in the Elements panel ("Event Listeners" section in the sidebar.)

Alexander Pavlov
  • 30,691
  • 5
  • 65
  • 91