Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all registered events of a DOM node using JavaScript?

I can add or remove an event handler for a DOM node. Is it possible to find out all the registered events handlers of a given DOM node? I am referring to straight Javascript meaning no frameworks or toolkits like jQuery, dojo, Prototype, GWT, etc. If the answer is no, any reason why? Security issues?

like image 938
Murali VP Avatar asked Sep 25 '09 03:09

Murali VP


2 Answers

I know this is an old question, but just in case, for chrome you can use getEventListeners

https://developers.google.com/chrome-developer-tools/docs/commandline-api#geteventlistenersobject

as mentioned here:

https://stackoverflow.com/a/17466308/538752

like image 108
roy riojas Avatar answered Nov 09 '22 06:11

roy riojas


DOM Level 3 specifies eventListenerList - however, I'm not aware of any DOM implementation which supports this - or any other reliable way to list the event listeners. It seems to have been an oversight to this point.

like image 31
TML Avatar answered Nov 09 '22 06:11

TML