Last active
December 21, 2015 08:22
-
-
Save tregusti/1111cbb3324fde25b27d to your computer and use it in GitHub Desktop.
Output currently selected element in the browser console
This file contains hidden or 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
(function() { | |
var a | |
setInterval(function() { | |
var a1 = document.activeElement | |
if (a !== a1) { | |
a = a1 | |
var s = a.nodeName.toLowerCase() | |
if (a.id) s += '#' + a.id | |
if (a.className.trim()) s += '.' + a.className.trim().split(/\s/g).join('.') | |
console.log('focused: %s %o', s, a) | |
} | |
}) | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment