Created
July 5, 2014 19:58
-
-
Save clavery/9effc3d5e4f56067d4c5 to your computer and use it in GitHub Desktop.
snippet to list event jquery event callbacks attached to a dom element in chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.handlers = function() { | |
var handlers = $.map($._data(this, 'events'), function(events, name) { | |
var fname = eval("function " + name + "() {}; "+name); | |
return $.map(events, function(event) { | |
var h = new fname(); | |
h["handler"] = event.handler; | |
return h; | |
}) | |
}); | |
return handlers; | |
} | |
// right click on function -> "Show Function" Definition | |
document.handlers(); | |
$0.handlers(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment