In the world of dynamically updated page fragments via Ajax (often lacking the use of best practices!), I encounter the attachment of event listeners scattered all over an application's JS. Sometimes, the developer would have adhered to some practical conventions that make it somewhat easy to track down code that attaches specific event listeners to DOM elements. Not always.
In this sad scenario, what is the best way to enumerate/view event listeners attached to a particular node/element? I enjoy using Chrome's amazing developer tools, although this is one area where the tool does not give me a whole lot of information.
Can I employ JavaScript or jQuery code to:
- view a list of event listeners
- track the code that sets up an event listener
Note: I originally asked about a way to examine event listeners in Chrome Dev Tools, but if there is a way to do it in code, I actually prefer that!
Edit: This answer is what I was looking for!