Focus event delegation, only one issue remaining

Focus event delegation, only one issue remaining


Hi folks,
I'm trying to use event delegation for form validation, for two
reasons:
- Performance: Adding only a few handlers to the form is way faster
then adding handlers to each element when dealing with large forms
(say, more then 100...)
- Ease of use: Event delegation handles dynamic forms automatically,
there is no need to "refresh" anything, eg. adding the necessary event
handlers to an element that just got added to the form
It didn't take long to discover that neither focus nor blur events on
input elements bubble, breaking my easy approach apart. So without a
bubbled focus event available, I tried to fake one. The current result
is here: http://dev.jquery.com/view/trunk/plugins/validate/test/events.html
The trick is to listen for keyup, mousedown and click events on the
form, and determine whether one of those events gives the target, if
it is an input, focus. For the blur event I just bind a handler to the
target directly via one("blur").
I have that working in FF2, Safari 3 and Opera 9. Only IE 6 and 7 give
me a little issue that I couldn't solve yet: They both don't trigger a
keyup event when tabbing from outside the page (from the browser
controls at the top) to the first input on the page. Of course that is
only an issue when there is nothing else focusable in front of the
form, but I'd still like to solve it.
Any ideas on that issue and also some more testing are both very
welcome. I'd like to get this rock-solid before putting it into the
validation plugin.
Thanks
Jörn