Skip to content

Instantly share code, notes, and snippets.

@pegasuspect
Last active August 10, 2018 20:54
Show Gist options
  • Save pegasuspect/f1a2b898af1194af388a to your computer and use it in GitHub Desktop.
Save pegasuspect/f1a2b898af1194af388a to your computer and use it in GitHub Desktop.
Paste it to developer console and click on any element.
var eventsToBeDebuggedSeperatedBySpaces = 'focus';
$('*').each(function(){
var eventHandler = function(event) {
var el = $(event.currentTarget).clone();
var str = $("<div>").append(el).html();
str = str.substring(0, str.indexOf(el.html()))
console.log(str.trim().length == 0 ? this.tagName : str.substr(0, 120));
}.bind(this);
this.addEventListener(eventsToBeDebuggedSeperatedBySpaces, eventHandler, true);
this.addEventListener(eventsToBeDebuggedSeperatedBySpaces, eventHandler, false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment