Created
August 5, 2009 08:37
-
-
Save RStankov/162593 to your computer and use it in GitHub Desktop.
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(){ | |
function focusInHandler(e){ | |
Event.findElement(e).fire("focus:in"); | |
} | |
function focusOutHandler(e){ | |
Event.findElement(e).fire("focus:out"); | |
} | |
if (document.addEventListener){ | |
document.addEventListener("focus", focusInHandler, true); | |
document.addEventListener("blur", focusOutHandler, true); | |
} else { | |
document.observe("focusin", focusInHandler); | |
document.observe("focusout", focusOutHandler); | |
} | |
})(); | |
document.on('focus:in', selector, function(){ | |
// on focus | |
}); | |
document.on('focus:out', selector, function(){ | |
// on blur | |
}); |
I don't know from the docs - http://api.prototypejs.org/dom/event/prototype/element/ and from I have communicated with the Prototype Core it will be removed some day. Prototype as a whole is moving really really slow :( But I prefer my code to use the no deprecated funcs. (as for ClassNames, Position, $continue, Insertation, Toggle I use a custom build and not include those)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deprecated? Maybe. Removed? Deprecated things like Element.ClassNames, Position, $continue, Insertion, Toggle are still not removed. Why such widely used (e.g. in scriptaculous, ajaxtags, livepipe, modalbox, tablekit) method like Event.element will be removed in the (near) future?