W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2004

[whatwg] Autofocus attribute

From: Olav Junker Kjr <olav@olav.dk>
Date: Thu, 05 Aug 2004 09:50:14 +0200
Message-ID: <WorldClient-F200408050950.AA50140511@jirty.dk>
> 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?

This is my take on in what order things happen, when a document it loaded:

First, of course, the doctype is parsed, which defines how the rest of the
document should be processed.
Controls are added incrementally to the document as soon as they are
parsed. If a control has an autofocus attribute, the control receives
focus immideately.
If a select element with a data attribute is parsed, the data source is
fetched immideately and the control is autofilled.
If a repetition template is parsed, initial repetition blocks are inserted
immideately.

When the whole document is parsed (but not nessecary all external
ressources like images has been retrieved), then forms with a data
attribute is prefilled from the data source.

After that, the load event are fired.

One question is when the "form" DOM property is initialized. I think this
could happen only when the whole document is parsed, since a control at
the top of the page might refer by id to a form at the bottom. So this
should happen just before forms are autofilled.

Olav Junker Kj?r
Received on Thursday, 5 August 2004 00:50:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:36 UTC