- From: <bugzilla@jessica.w3.org>
- Date: Thu, 03 Jun 2010 13:07:53 +0000
- To: public-html-bugzilla@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=9843 Summary: Specced behavior for document.write("<link rel=stylesheet href=...><script>...</script>...") matches none of the top 4 engines Product: HTML WG Version: unspecified Platform: PC URL: http://hsivonen.iki.fi/test/moz/sheet-blocking-script. html OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: HTML5 spec (editor: Ian Hickson) AssignedTo: ian@hixie.ch ReportedBy: hsivonen@iki.fi QAContact: public-html-bugzilla@w3.org CC: bzbarsky@mit.edu, mike@w3.org, public-html@w3.org, jonas@sicking.cc, eric@webkit.org Consider: document.write("<link rel=stylesheet href=...><script>...</script>...") According to the spec, the style sheet becomes a style sheet blocking scripts. http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#a-style-sheet-blocking-scripts The according to http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-incdata , case An end tag whose tag name is "script", subcase "Otherwise", step 3, the UA must "Spin the event loop until there is no style sheet blocking scripts and the script's "ready to be parser-executed" flag is set." As far as I can tell, this is not what happens in reality. What seems to happen is: In Gecko (old and new parser), the style sheet becomes a style sheet blocking scripts, the parser blocks at the written </script> and document.write returns early before the written content after </script> has been tokenized. In IE8, the style sheet becomes a style sheet blocking scripts, but document.written internal scripts are immune to style sheets blocking scripts, so the document.write tokenizes to completion and the next inline script from the network blocks on the style sheet. (Sorry, the demo doesn't prove the part about the next network-originating script blocking without editing the demo and experimenting.) In Chrome beta channel, the style sheet doesn't block scripts but blocks painting. The whole page is parsed to completion but isn't painted until the style sheet has been loaded. In Opera, the style sheet doesn't block anything. The page FOUCs. I think *any* of these four behaviors is preferable over creating a nested event loop from within document.write(), so I request the spec be changed to one of the pre-existing behaviors on this point. If Gecko's behavior is chosen for the spec, it would be necessary to specify that the style sheet fetch completes asynchronously (even if the style sheet were available immediately) in order to avoid making the document.write return behavior sensitive to caching or to the URL scheme (data: URLs). I don't have data to be able to argue the choice among the four behaviors based on compatibility data. IE's behavior is the hardest to distinguish from what the spec says now. Note that it's not necessary to change the behavior for the case where the <link> and the internal script come from the network stream, since that can be handled per current spec (and Gecko does) without creating a nested event loop. -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug.
Received on Thursday, 3 June 2010 13:07:55 UTC