Chrome Developer Tools – monitorEvents
Tuesday, October 4th, 2011I have been playing with the Chrome Developer Tools lately. Here is a cool feature I didn’t know about.
There are many times I have ran some code like this:
$("body").bind("click mousedown", function(e) { console.log(e); });
Inspect an element (see screenshot). Now that it has been inspected, there is a $0 variable available in the console.
Instead of that extra bind, you can just type this into the console:
monitorEvents($0, 'mouse')
You can also use ‘key’ instead of ‘mouse’ if you are tracking key events. There are actually a number of second parameters, via the Firebug command line API. Note: not all of these seem to be supported by Chrome dev tools. Here they are:
composition contextmenu drag focus form key load mouse mutation paint scroll text ui xul

