[whatwg] Autofocus attribute

Ian Hickson ian at hixie.ch
Sun Aug 22 05:20:52 PDT 2004

On Tue, 3 Aug 2004, Brian Wilson wrote:
> I mean... Two form fields are in a document, one has the 
> autofocus="autofocus" attribute set, the other is given focus by the 
> focus() javascript method at body onLoad time. Which should have focus 
> when the document finishes loading? In other words, how does/should the 
> autofocus attribute figure in to the document loading event chain 
> chronology?

The spec says "When a form control is inserted into a document, the UA 
must check to see if it has this attribute set. If it does, and if the 
control is not disabled, then the UA should focus the control, as if the 
control's focus() method was invoked. (When multiple elements are 
simultaneously inserted into the document, they must all perform this, in 
document order.)".

Doesn't think answer the question?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list