- From: Ian Hickson <ian@hixie.ch>
- Date: Mon, 31 Jul 2006 22:34:55 +0000 (UTC)
I'm trying to spec document.write() and I've run into a difficult edge case. Imagine the server sees this: <!DOCTYPE HTML> <html> <head> function test() { document.write('TEST'); } setTimeout(test, 1000); </head> <body> <p><img src="test.png" alt="" onload="test()"></p> ...and then time passes. The image loads, the timeout fires. Then once the image has loaded and the timer has fired: </body> </html> ...and the connection is closed. What should happen? IE seems to make those calls to document.write() simply blow away the document, as if the document was closed. Opera seems to do the same. Mozilla seems to make the document.write() calls insert text into the parser, as if they'd been called inline, with the result that the inserted text could appear pretty much anywhere. (It's actually a bit more complex than that -- it avoids inserting into tokens -- but that's a detail.) I couldn't work out what Safari and MacIE do; they seem to delay the timeout somehow and then print to the end of the page. Any preferences? I'm particularly interested in feedback from browser developers here as to whether there is anything I should know about how easy/hard it is to do one thing or the other. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 31 July 2006 15:34:55 UTC