Is there any way to view what functions / code are attached to any event for a DOM element? Using Firebug or any other tool.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Event handlers attached using traditional
element.onclick= handleror HTML<element onclick="handler">can be retrieved trivially from theelement.onclickproperty from script or in-debugger.Event handlers attached using DOM Level 2 Events
addEventListenermethods and IE’sattachEventcannot currently be retrieved from script at all. DOM Level 3 once proposedelement.eventListenerListto get all listeners, but it is unclear whether this will make it to the final specification. There is no implementation in any browser today.A debugging tool as browser extension could get access to these kinds of listeners, but I’m not aware of any that actually do.
Some JS frameworks leave enough of a record of event binding to work out what they’ve been up to. Visual Event takes this approach to discover listeners registered through a few popular frameworks.