Garrett Smith wrote:
Because you have <script>s after your stylesheets, not just stylesheets.
Really, controlled experiments are hard. You have to hold all but one
variable constant.
OK, I modified the example:
http://localhost/jstest/block/link-img-noscript.html
The bottom script will not load ('load' as opposed to 'run') in
Firefox/3.0.6 until after 5 seconds.
Right. Because you still have another script before it.
The result shows that example.js loads 5 seconds after the initial
page load. example.js waits for the stylesheet to load.
It waits for the first script to execute, which waits for the stylesheet
to load. That's not quite the same thing.
My concern is with the recomputation you mentioned. Can you elaborate
on that, or point me to a webpage that explains it?
Well, once a new stylesheet loads you have to redo rule matching for all
nodes that might be affected in the document. In practice, I believe
current UAs will rerun the rule matching algorithm on all nodes in the
document.
Question: What does IE do?
That's a really good question. I don't have IE on hand to test with; do
you?
Well, one option is to stop worrying about micromanaging the load order and
assume that speculative parsing will solve your problems.... will it?
Possibly. If the author could declare what a script depends on and let
the implementation determine what to load and when, would that be too
complicated?
Too complicated for whom? The author or the implementation?
-Boris