- From: Olav Junker Kjær <olav@olav.dk>
- Date: Thu, 05 Aug 2004 09:50:14 +0200
> 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