Skip to content

Instantly share code, notes, and snippets.

@clavery
Created July 5, 2014 19:58
Show Gist options
  • Save clavery/9effc3d5e4f56067d4c5 to your computer and use it in GitHub Desktop.
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
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