UIEvents should provide relatedTarget property

There are scenarios when it's important to know which element is gaining 
focus. Currently it's impossible to find out which element is going to get 
the focus within a blur() or focusout() event handler.

Thus, I suggest to add a "EventTarget relatedTarget" property to the UIEvent 
class...

   a)  pointing to the element which gains focus within blur() and 
focusout() events,

   b)  pointing to the element which has lost focus within focus() and 
focusin() events.



Moreover, an event sequence policy should be defined, stating the focus() 
will immediately follow blur() and focusin() will immediately follow 
focusout().

Currently, Google Chrome and Apple Safari enqueue focusin() *after* 
focusout() has returned. This causes other events to intercept these two 
events (e.g. a call to setTimeout(..., 0). This should not be possible.


Calling element.focus() within a blur() event handler should update the 
target for the enqueued focus() event but not re-enqueue the focus() event. 
Same for focusin()/focusout().


Axel Dahmen
www.axeldahmen.de 

Received on Thursday, 8 April 2010 00:05:12 UTC