Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sstephenson
Created July 21, 2009 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sstephenson/151528 to your computer and use it in GitHub Desktop.
Save sstephenson/151528 to your computer and use it in GitHub Desktop.
(function() {
var focusInHandler = function(e) { e.findElement().fire("focus:in") };
var focusOutHandler = function(e) { e.findElement().fire("focus:out") };
if (document.addEventListener) {
document.observe("focus", focusInHandler, true);
document.observe("blur", focusOutHandler, true);
} else {
document.observe("focusin", focusInHandler);
document.observe("focusout", focusOutHandler);
}
})();
document.observe("focus:in", function(e) {
console.log("focused", e.findElement());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment