On 8/28/12 2:12 AM, Ian Hickson wrote:
On Tue, 28 Aug 2012, Boris Zbarsky wrote:
As far as I can tell, "0 1 2" in your testcase at
http://damowmow.com/playground/demos/document-write-and-scripts/002.html is
consistent with the following order of execution:

1)  x=0
2)  x1=0,x=1 (nothing else has run yet because we're waiting on
     blank.js)
3)  setTimeout fires, sets x2 = 1
3)  second external script runs, sets x = 2.

There's only one external script. The script after the style sheet is
internal.

Agreed.

If it blocks, you get "0 1 2" (when x2 gets set to x in the
timeout, it's still x=1, because the next script, which sets x=2, hasn't
run). In Gecko, however, that internal script doesn't block, and so the
timeout runs after x has been set to 2. Hence "0 2 2".

Right.

The reason for having the external script in 002.html is that it causes
document.write() to return right there

Ah, I see. So is what you're proposing that stylesheets that are inserted by a "nested tokenizer" not block scripts in general, but stylesheets that are inserted by a top-level tokenizer block scripts as usual?

Or is what you're proposing that scripts that are inserted by a "nested tokenizer" not block on stylesheets?

-Boris

Reply via email to