why not onfocus and onblur instead of onfocusin and onfocusout?

563 views
Skip to first unread message

Venkat

unread,
Jan 19, 2010, 3:08:33 PM1/19/10
to jQuery Entwine
Why do you use onfocusin and onfocusout instead of onfocus and onblur?
It would be more consistent.

Thanks!

hamish

unread,
Jan 19, 2010, 3:31:38 PM1/19/10
to jQuery Entwine
Hi,

Not all events bubble - events that don't bubble need special handling
in order to be able to delegate them like Entwine does (and like
jquery live does). Most of the techniques I use to do this handling
come from the jquery plugin http://plugins.jquery.com/project/Live-Extension,
which is where focusin and focusout originally come from.

The root cause of the naming is that for IE we use the browser-
specific events focusin and focusout, and in other browsers we use
blur and focus in capture mode.

I actually prefer focusin and focusout (they pair with mousein and
mouseout), and the semantics of the event are slightly different to
focus and blur - you can bind focusin and focusout to any element, not
just input elements, and they trigger whenever any child gains or
loses focus.

I've been thinking of adding focusenter and focusleave to pair with
mouseenter and mouseleave, and a bunch of other custom events,
probably as a plugin. If there's strong enough demand I'll make that
plugin alias focus and blur to focusin and focusout.

Hamish Friedlander

Venkat

unread,
Jan 19, 2010, 4:59:16 PM1/19/10
to jQuery Entwine
Okay. I don't mind focusin and focusout. I just wanted to know if
there was a reason behind it.

Thanks!

On Jan 19, 12:31 pm, hamish <ham...@silverstripe.com> wrote:
> Hi,
>
> Not all events bubble - events that don't bubble need special handling
> in order to be able to delegate them like Entwine does (and like
> jquery live does). Most of the techniques I use to do this handling

> come from the jquery pluginhttp://plugins.jquery.com/project/Live-Extension,

Reply all
Reply to author
Forward
0 new messages