[whatwg] What should document.write() do when called from setTimeout or event handlers?

On Mon, 31 Jul 2006, Andrew Fedoniouk wrote:
> 
> From implementation point of view: all events shall be disabled
> until "original DOM complete" state (</html> parsed and processed).
> Precisely - events shall be postponed (probably some of them may just
> be discarded). First event that shall be fired is window.onload (?)

Unfortunately that would break existing pages, so that's not really an 
option.


> Normaly when document.write appears in the <script> section
> body of the script has been loaded in full so insertion point for the
> write is known - end of the script block.
> document.write in other circumstances (event handlers) shall use
> end of the body element (?) as an append point.

I assume you mean this in addition to the stopping of events you mention 
above. If you don't, then the problem is that document.write() doesn't add 
to the _document_, it adds to the tokeniser's input stream, and the 
tokeniser could be half-way through parsing another token at the time.

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

Received on Monday, 31 July 2006 22:38:17 UTC