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

Ian Hickson ian at hixie.ch
Mon Jul 31 22:38:17 PDT 2006


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.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list