Re:A new set of Firefox Developer Tools features
by theallan on Monday August 04, 2014 @04:57AM
(#8130875)
I found that (in some browsers - not all) that calling `toString()` on the function that has been attached (which you can get by poking around in the jQuery cache) returns the raw, formatted, function - with comments, etc. You can then do a simple `indexOf()` on the `textContent` of the `<script>` tag (for loaded scripts I do an Ajax get to pull in the text of the script, which isn't perfect since remote domains fail, but its a start).
The end result is that, when possible (Safari and Chrome) the script will tell you where the event listener was bound.
I haven't looked into it, but I presume the Firefox dev tools are using information directly from the DOM, since they have access to that. But there is no public interface in DOM to get the event listeners for a node, which I cursed at the time, but in retrospect it makes the above possible.
My Visual Event tool makes use of that:
The end result is that, when possible (Safari and Chrome) the script will tell you where the event listener was bound.I haven't looked into it, but I presume the Firefox dev tools are using information directly from the DOM, since they have access to that. But there is no public interface in DOM to get the event listeners for a node, which I cursed at the time, but in retrospect it makes the above possible.