Created
December 14, 2009 07:21
-
-
Save lsmith/255870 to your computer and use it in GitHub Desktop.
This file contains 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
document.addEventListener('focus', prepareHandler, true); // capture phase | |
input.addEventListener('focus', inputHandler, false); | |
function prepareHandler(e) { | |
var name = e.target.name; | |
process[name] = true; | |
setTimeout(function () { | |
if (process[name]) { | |
// do stuff (e is available, but its methods are useless) | |
} | |
}, 10); | |
} | |
function inputHandler(e) { | |
var name = e.target.name; | |
if (/* some condition */) { | |
process[name] = false; | |
e.stopImmediatePropagation(); | |
e.preventDefault(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment