[whatwg] scripts, defer, document.write and DOMContentLoaded

Boris Zbarsky bzbarsky at MIT.EDU
Mon Jul 20 23:20:27 PDT 2009

Ian Hickson wrote:
> The change I have checked in makes us more compatible with what IE 
> actually does here, which pages are apparently relying on. We could also 
> make the spec introduce a whole new kind of behaviour, such as the one 
> Jonas described, but that seems just as likely to have compatibility 
> problems as what the spec said before, and also has some weird 
> side-effects, like making it possible for the parser to go through the EOF 
> point more than once, or having odd behaviour around document.close().

The thing is, your behavior also introduces issues as far as I can see 
(e.g. requirements that network loads be performed while a script is 
running without reentering the script, which means not firing any 
progress events associated with those network loads, requirements about 
execution of <script> with src pointing to javascript URIs, if those are 
supported to start with, etc, etc).

It's not clear to me that what you're proposing is any simpler than what 
Jonas is proposing.

Note that the bugs he cited had to do with various problems he brought 
up with the spec text, including but not limited to this one.  Which, if 
any, of them actually require this innerHTML behavior?  From my reading
of the bugs, none of them really do.

I'd be very interested in other implementor feedback here, but it seems 
to me that the current proposal is much more complicated than simply 
saying that document.write in a deferred script never blows away the 
document...  Is that not sufficiently compatible for some reason?


More information about the whatwg mailing list