[whatwg] defer on style, depends

Boris Zbarsky bzbarsky at MIT.EDU
Mon Feb 9 11:54:57 PST 2009


Garrett Smith wrote:
> There are two/three issues.
> 1) want to load stylesheets without having scripts block

Already doable for alternate stylesheets, right?

I assume the use case is a script that wants to modify the DOM 
immediately but doesn't depend on any styling information?  That's a 
property of the script, not the stylesheet, correct?

> 2) want to load stylesheets later, (infoPanel example)

Not sure what this example is, or why this is insufficienty served by, 
say, putting the <link> at the end of the HTML (assuming HTML allowed 
that, of course).

> 3) (2), but want to make sure the stylesheet is loaded before the script runs.

> (1) <link independent ..> would address the problem.

Independent of what?  In case (1) it's the script that doesn't depend on 
the stylesheet, as far as I can see.  The stylesheet just exists.

> Example 1:
> <head><title></title>
> <link independent type="text/css"  ...>
> <script...></script>
> I want the browser to:
> 1) load my stylesheet and then immediately begin to load script in parallel.

That's exactly what Gecko does in this case, for what it's worth.  It 
will load the script in parallel, but won't _execute_ the script until 
the non-alternate stylesheet has loaded.

> Example 2
> <head><title></title>
> <link defer type="text/css" id="lateBoundCSS" ...>

What is the use case for such CSS, exactly?

> 1) defer my linked stylesheet id="lateBoundCSS" until content is rendered
> 2) render content
> 3) upon encountering the deferred script, check the depends
> 4) upon finding Result(3) is "lateBoundCSS", wait for that resource to
> finish load before running.

Is this a common use case?  Would it be sufficient to address it via a 
load handler on <link> so that one could build whatever dependency or 
ordering setup one wants?

> The infoPanel script needs the infoPanel.css stylesheet,
> id="lateBoundCSS". The css is only related to that script, it is
> useless otherwise.

You mean the CSS is not actually used to style the document?

>>> Whatever.
>> That's a very cogent and enlightening response, I'm sure, but it seems to be
>> going over my head.  Care to explain in terms someone of my limited mental
>> ability can understand?
>>
> 
> Boris, you have snipped what I replied to (the part Ian wrote before I
> wrote "whatever").

Yes, because your response wasn't a response to what Ian wrote.  I do 
happen to agree with Ian's opinion there, for what it's worth.  Want to 
try convincing me that I'm wrong?  "Whatever" is not convincing enough, 
sorry.

> You replied to that out-of-context snip with a loaded question that
> seems very sarcastic.

I doesn't just seem.  It _was_ sarcastic.  I have to admit I was 
somewhat at a loss for how else one could respond to someone saying 
"Whatever" in response to a specific technical argument...

> I do not think it such sarcasm is appropriate. I
> do not think it would be at all productive to answer such questions.

That depends on whether you want me to take your proposals seriously. 
If you do, you might want to take concerns raised about said proposals 
seriously.

-Boris




More information about the whatwg mailing list