[whatwg] scripts, defer, document.write and DOMContentLoaded
Ian Hickson
ian at hixie.ch
Mon Jul 20 23:01:21 PDT 2009
On Mon, 20 Jul 2009, Boris Zbarsky wrote:
> Ian Hickson wrote:
> > Actually what's going on is more subtle than that. When you set
> > innerHTML, it's actually triggering the deferred scripts right there,
> > if it has them loaded (e.g. inline scripts or cached scripts). If it
> > doesn't have them loaded yet, it drops them on the floor and doesn't
> > ever run them.
> >
> > I've specced this, except that the spec requires that not-yet-loaded
> > scripts be loaded then run, rather than dropped, before innerHTML
> > continues, so there's no race conditions.
>
> Er... wait. So innerHTML has to block on network access? And possibly
> spin the event loop as it does so?
>
> This doesn't seem desirable to me.... Why do we want this behavior?
Jonas describes why what the spec said before was a compatibility problem
in his e-mail:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-July/020843.html
He cites the following bugs:
https://bugzilla.mozilla.org/show_bug.cgi?id=28293
https://bugzilla.mozilla.org/show_bug.cgi?id=461555
https://bugzilla.mozilla.org/show_bug.cgi?id=461724
https://bugzilla.mozilla.org/show_bug.cgi?id=469751
https://bugzilla.mozilla.org/show_bug.cgi?id=474392
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().
--
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