RE: Deprecating DOMFocusIn/DOMFocusOut

Do we really need eventTarget? It seems to me that focusin/focusout can remain UIEvents, and if web developers want to know what the "releatedTarget" is, then can simply register for both: focusout is the element loosing focus, focusin is the element gaining focus. You don't even have to know which Node to register them on because these events bubble, you can simply listen at the document level.

Does that make sense?

> -----Original Message-----
> From: www-dom-request@w3.org [mailto:www-dom-request@w3.org] On
> Behalf Of Olli Pettay
> Sent: Tuesday, September 15, 2009 10:48 AM
> To: Jacob Rossi
> Cc: Doug Schepers; mjs@apple.com; www-dom@w3.org
> Subject: Re: Deprecating DOMFocusIn/DOMFocusOut
> 
> On 9/15/09 8:25 PM, Jacob Rossi wrote:
> >>> On Sep 14, 2009, at 11:21 PM, Doug Schepers wrote:
> >>>
> >>>> I did adapt focusin and focusout to the existing DOM event
> >>>> interfaces a little: rather than add the orginal (and useful) IE
> >>>> 'toElement' and 'fromElement' properties, I mapped them to to the
> >>>> 'target' and 'currentTarget' properties, respectively.
> >>>
> >>> Instead of 'currentTarget', I'd suggest adding the 'relatedTarget'
> >>> attribute from mouse events to focus events. 'target' and
> >>> 'currentTarget' already have well-defined and useful meanings for
> >>> all events, so I don't think we should change the meaning of these
> >>> for focus events.
> >>
> >> I considered that, but it would also require a change to either the
> >> Event or UIEvent interface, and I didn't think that was necessary...
> >> 'currentTarget' actually describes it pretty well, since focusin
> >> happens before the focus shift, and it there doesn't seem to be a
> >> current value for 'currentTarget' on focusin or focusout events.
> >
> > I have to disagree. I don't think currentTarget is a good descripter
> > of this element. That would be very inconsistant with its meaning in
> > any other event's dispatch:  "From the perspective of an event
> > listener this shall be the event target the listener has been
> > registered on. " The to and from elements are not necessarily even a
> > part of the event flow propagation path (much less, the target on
> > which the listener registered). We should keep this definition
> > consistant.
> >
> > I agree with Maciej that relatedTarget makes more sense. I'd be in
> > favor of adding it to UIEvent rather than make a FocusEvent simply
> > because I'd rather not have yet another set of init_____Event() and
> > init____EventNS(). :-)
> >
> 
> adding .relatedTarget to UIEvent would break backward compatibility, unless
> the new parameter for initUIEvent would be optional.
> Also, it would be a bit strange to have relatedTarget as the 7th parameter of
> initUIEvent, but 15th of initMouseEvent.
> (We can't change the order of initMouseEvent's parameters)
> 
> I don't like initXXXEvent either, but since we have them, it is better to keep
> them working consistently.
> 
> 
> So mainly just because of this I'd add FocusEvent.
> It should probably extend UIEvent, although the traditional focus and blur
> events are just Events (in DOM 2 Events).
> Those events could be changed to be FocusEvents.
> 
> 
> -Olli
> 

Received on Tuesday, 15 September 2009 20:21:52 UTC