W3C home > Mailing lists > Public > public-html@w3.org > October 2009

Re: [HTML5] DOMContentLoaded fires before CSS resources loaded?

From: Ian Hickson <ian@hixie.ch>
Date: Sun, 11 Oct 2009 08:02:58 +0000 (UTC)
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: "public-html@w3.org" <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0910090915050.25383@hixie.dreamhostps.com>
On Sun, 4 Oct 2009, Boris Zbarsky wrote:
> Ian Hickson wrote:
> > For _any_ <script> element, internal or external, parser-inserted and
> > dynamically inserted, once the script has loaded and is about to be
> > executed, if there are "pending style sheets" (defined below), then act as
> > if the script had not yet finished loading, until such time as any "pending
> > style sheets" have loaded.
> > 
> > "Pending style sheets" are those that were referenced by <link> or <style>
> > elements inserted by the parser, or Link: HTTP headers, and that were
> > inserted into the document (by the parser) _before_ the relevant <script>
> > was inserted into the document (by the parser or script).
> 
> Assuming "have loaded" includes loading all @import descendants, I believe
> this would more or less match Gecko's current behavior, yes, with two
> differences I can think of:
> 
> 1) Stylesheets are only considered pending if they were in the then-selected
> stylesheet set when they were inserted into the document.  That is, alternate
> stylesheets don't block anything from happening in Gecko right now.
> 
> 2) Gecko does not impose the "before the relevant <script>" condition. If a
> stylesheet is pending and you insert a <script> dynamically (off a timeout
> say), and then another stylesheet load starts from the parsr (which didn't
> block on the dynamically inserted script, of course) before the previous one
> completes, the <script>s execution will wait on the end of that second
> stylesheet load as well.
> 
> I'm not 100% wedded to this behavior, though I do happen to think it 
> makes sense (modulo caveat 2 above possibly).  But I'm biased, 
> obviously; if I thought it didn't make sense I would have implemented it 
> differently.  If there are obvious issues with it, or just obvious 
> improvements to be made, I'd be quite happy to know what they are.  I 
> can see how the "inserted before the relevant <script>" condition might 
> make more sense, but it involves a lot more bookkeeping (in particular 
> keeping track of which stylesheets are loading, not just whether any are 
> loading at all), which is sort of why we didn't implement it that way 
> (or rather why the idea hadn't even been considered).

Done.


> > It also sounds like you want the parser to stop blocking everything 
> > while waiting for an external script to finish loading.
> 
> Right; on this I feel much more strongly than on the precise behavior of 
> stylesheet/script interaction...  Blocking processing of data in the 
> parser is a must.  I'm not sure blocking processing of everything else 
> is reasonable.

Also done.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Sunday, 11 October 2009 07:52:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:09 UTC