hixie: Define how <script> gets blocked while <style>@import</style>, and a general rewrite of how <script>s are executed and interact with the parsers. (whatwg r4103)

hixie: Define how <script> gets blocked while <style>@import</style>,
and a general rewrite of how <script>s are executed and interact with
the parsers. (whatwg r4103)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3261&r2=1.3262&f=h
http://html5.org/tools/web-apps-tracker?from=4102&to=4103

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3261
retrieving revision 1.3262
diff -u -d -r1.3261 -r1.3262
--- Overview.html 9 Oct 2009 11:02:07 -0000 1.3261
+++ Overview.html 11 Oct 2009 07:51:16 -0000 1.3262
@@ -216,7 +216,7 @@
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
    <!--ZZZ:-->
    <!--<h2 class="no-num no-toc">W3C Working Draft 25 August 2009</h2>-->
-   <h2 class="no-num no-toc" id="editor-s-draft-9-october-2009">Editor's Draft 9 October 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-11-october-2009">Editor's Draft 11 October 2009</h2>
    <!--:ZZZ-->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out--><!--
     <dt>This Version:</dt>
@@ -318,7 +318,7 @@
   track.
   <!--ZZZ:-->
   <!--This specification is the 25 August 2009 Working Draft.-->
-  This specification is the 9 October 2009 Editor's Draft.
+  This specification is the 11 October 2009 Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href="http://www.whatwg.org/">WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -6796,7 +6796,7 @@
   document as this occurs.<p class="example">HTML has a <code><a href="#the-progress-element">progress</a></code> element that
   describes a progress bar. If its "value" attribute is dynamically
   updated by a script, the UA would update the rendering to show the
-  progress changing.<h4 id="elements-in-the-dom"><span class="secno">3.2.2 </span>Elements in the DOM</h4><p>The nodes representing <a href="#html-elements">HTML elements</a> in the DOM
+  progress changing.<h4 id="elements-in-the-dom"><span class="secno">3.2.2 </span>Elements in the DOM</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><p>The nodes representing <a href="#html-elements">HTML elements</a> in the DOM
   <span class="impl">must</span> implement, and expose to scripts, the
   interfaces listed for them in the relevant sections of this
   specification. This includes <a href="#html-elements">HTML elements</a> in <a href="#xml-documents">XML
@@ -6926,7 +6926,7 @@
   <a href="#html-elements">HTML elements</a> that are not defined by this
   specification (or <a href="#other-applicable-specifications">other applicable specifications</a>).</p>
 
-  </div><h4 id="global-attributes"><span class="secno">3.2.3 </span><dfn>Global attributes</dfn></h4><p>The following attributes are common to and may be specified on
+  </div><h4 id="global-attributes"><span class="secno">3.2.3 </span><dfn>Global attributes</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><p>The following attributes are common to and may be specified on
   all <a href="#html-elements">HTML elements</a><span class="impl"> (even those not
   defined in this specification)</span>:<ul class="brief"><li><code title="attr-accesskey"><a href="#the-accesskey-attribute">accesskey</a></code></li>
    <li><code title="attr-class"><a href="#classes">class</a></code></li>
@@ -7398,7 +7398,7 @@
   these attributes or values. Specifications intended for user agents
   must not define these attributes to have any meaningful values.</p>
 
-  </div><h4 id="element-definitions"><span class="secno">3.2.4 </span>Element definitions</h4><p>Each element in this specification has a definition that includes
+  </div><h4 id="element-definitions"><span class="secno">3.2.4 </span>Element definitions</h4><p class="XXX annotation"><b>Status: </b><i>Implemented and widely deployed</i><p>Each element in this specification has a definition that includes
   the following information:<dl><dt>Categories</dt>
 
    <dd>A list of <a href="#content-categories" title="content categories">categories</a> to
@@ -7434,7 +7434,7 @@
   </dl><p>This is then followed by a description of what the element
   <a href="#represents">represents</a>, along with any additional normative
   conformance criteria that may apply to authors<span class="impl" title=""> and implementations</span>. Examples are sometimes
-  also included.<h4 id="content-models"><span class="secno">3.2.5 </span><dfn>Content models</dfn></h4><p>Each element defined in this specification has a content model: a
+  also included.<h4 id="content-models"><span class="secno">3.2.5 </span><dfn>Content models</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Implemented and widely deployed</i><p>Each element defined in this specification has a content model: a
   description of the element's expected contents. An <a href="#html-elements" title="HTML
   elements">HTML element</a> must have contents that match the
   requirements described in the element's content model.<p class="note">As noted in the conformance and terminology
@@ -7728,7 +7728,7 @@
   defined in this specification. (For example, MathML, or SVG.)<p>Some embedded content elements can have <dfn id="fallback-content">fallback
   content</dfn>: content that is to be used when the external resource
   cannot be used (e.g. because it is of an unsupported format). The
-  element definitions state what the fallback is, if any.<h6 id="interactive-content-0"><span class="secno">3.2.5.1.7 </span>Interactive content</h6><!--
+  element definitions state what the fallback is, if any.<h6 id="interactive-content-0"><span class="secno">3.2.5.1.7 </span>Interactive content</h6><p class="XXX annotation"></p><!--
 TESTS:
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cp%20tabindex%3D1%3Etest%20%3Ca%20href%3D%22%22%3E%20%3Cem%3Etest%3C/em%3E%20%3C/a%3E%0A%3Cscript%3E%0A%20function%20test%20%28e%29%20%7B%20w%28e.type%20+%20%27%20on%20%27%20+%20e.target.tagName%20+%20%27%20through%20%27%20+%20e.currentTarget.tagName%29%3B%20%7D%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%3C/script%3E%0A
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Ca%20href%3Dhttp%3A//google.com/%20target%3Da%3EA%3C/a%3E%3Ca%20href%3Dhttp%3A//yahoo.com/%20target%3Db%3EB%3C/a%3E%3Cbr%3E%0A%3Ciframe%20name%3Da%3E%3C/iframe%3E%3Ciframe%20name%3Db%3E%3C/iframe%3E%0A%3Cscript%3E%0A%20var%20a%20%3D%20document.getElementsByTagName%28%27a%27%29%5B0%5D%3B%0A%20var%20b%20%3D%20document.getElementsByTagName%28%27a%27%29%5B1%5D%3B%0A%20a.appendChild%28b%29%3B%0A%3C/script%3E
@@ -7838,7 +7838,7 @@
   for that element. Activation behaviors can refer to the <code title="event-click">click</code> and <code title="event-DOMActivate">DOMActivate</code> events that were fired
   by the steps above leading up to this point.</p>
 
-  </div><h5 id="transparent-content-models"><span class="secno">3.2.5.2 </span>Transparent content models</h5><p>Some elements are described as <dfn id="transparent">transparent</dfn>; they have
+  </div><h5 id="transparent-content-models"><span class="secno">3.2.5.2 </span>Transparent content models</h5><p class="XXX annotation"><b>Status: </b><i>Implemented and widely deployed</i><p>Some elements are described as <dfn id="transparent">transparent</dfn>; they have
   "transparent" in the description of their content model.<p>When a content model includes a part that is "transparent", those
   parts must not contain content that would not be conformant if all
   transparent elements in the tree were replaced, in their parent
@@ -8721,7 +8721,7 @@
 
    <li>
 
-    <p>If there is a <a href="#pending-external-script">pending external script</a>, then the
+    <p>If there is a <a href="#pending-parsing-blocking-script">pending parsing-blocking script</a>, then the
     method must now return without further processing of the
     <a href="#the-input-stream">input stream</a>.</p>
 
@@ -9156,7 +9156,7 @@
 
    </li>
 
-  </ol></div><h2 id="semantics"><span class="secno">4 </span>The elements of HTML</h2><h3 id="the-root-element"><span class="secno">4.1 </span>The root element</h3><h4 id="the-html-element-0"><span class="secno">4.1.1 </span>The <dfn><code>html</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
+  </ol></div><h2 id="semantics"><span class="secno">4 </span>The elements of HTML</h2><h3 id="the-root-element"><span class="secno">4.1 </span>The root element</h3><h4 id="the-html-element-0"><span class="secno">4.1.1 </span>The <dfn><code>html</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><dl class="element"><dt>Categories</dt>
    <dd>None.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>As the root element of a document.</dd>
@@ -9287,7 +9287,7 @@
   </div><p>The string to use as the document's title is given by the <code title="dom-document-title"><a href="#document.title">document.title</a></code> IDL
   attribute. <span class="impl">User agents should use the document's
   title when referring to the document in their user
-  interface.</span><h4 id="the-base-element"><span class="secno">4.2.3 </span>The <dfn><code>base</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
+  interface.</span><h4 id="the-base-element"><span class="secno">4.2.3 </span>The <dfn><code>base</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#metadata-content">Metadata content</a>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>In a <code><a href="#the-head-element-0">head</a></code> element containing no other <code><a href="#the-base-element">base</a></code> elements.</dd>
@@ -9429,22 +9429,15 @@
   followed and 404 responses must cause the external resource to not
   be applied.)</p>
 
-  <!-- similar text in various places -->
-  <p>Fetching external resources must <a href="#delay-the-load-event">delay the load
-  event</a> of the element's document until the <a href="#concept-task" title="concept-task">task</a> that is <a href="#queue-a-task" title="queue a
-  task">queued</a> by the <a href="#networking-task-source">networking task source</a> once
-  the resource has been <a href="#fetch" title="fetch">fetched</a> (defined
-  below) has been run.</p>
-
-  <!-- the next paragraph is similar to text in the <style> section -->
-  <p>The <a href="#concept-task" title="concept-task">task</a> that is <a href="#queue-a-task" title="queue a task">queued</a> by the <a href="#networking-task-source">networking task
-  source</a> once the resource has been <a href="#fetch" title="fetch">fetched</a> must, if the loads were successful,
-  <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple event</a> named
-  <code title="event-load">load</code> at the <code><a href="#the-link-element">link</a></code>
-  element; otherwise, if the resource or one of its subresources
-  failed to completely load for any reason (e.g. DNS error, HTTP 404
-  response, a connection being prematurely closed, unsupported
-  Content-Type), it must instead <a href="#queue-a-task">queue a task</a> to
+  <!-- the next few paragraph are similar to text in the <style> section -->
+  <p>Once the attempts to obtain the resource and its critical
+  subresources are complete, the user agent must, if the loads were
+  successful, <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
+  event</a> named <code title="event-load">load</code> at the
+  <code><a href="#the-link-element">link</a></code> element, or, if the resource or one of its
+  critical subresources failed to completely load for any reason
+  (e.g. DNS error, HTTP 404 response, a connection being prematurely
+  closed, unsupported Content-Type), <a href="#queue-a-task">queue a task</a> to
   <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-error">error</code> at the <code><a href="#the-link-element">link</a></code>
   element. Non-network errors in processing the resource or its
   subresources (e.g. CSS parse errors, PNG decoding errors) are not
@@ -9453,6 +9446,14 @@
   <p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#dom-manipulation-task-source">DOM manipulation
   task source</a>.</p>
 
+  <p>The element must <a href="#delay-the-load-event">delay the load event</a> of the
+  element's document until all the attempts to obtain the resource and
+  its critical subresources are complete.</p>
+
+  <p>Which resources are considered critical or not is defind by the
+  relevant specification. For CSS resources, only <code title="">@import</code> rules introduce critical subresources; other
+  resources, e.g. fonts or backgrounds, are not.</p>
+
   <hr><p id="linkui">Interactive user agents may provide users with a
   means to <a href="#following-hyperlinks" title="following hyperlinks">follow the
   hyperlinks</a> created using the <code><a href="#the-link-element">link</a></code> element,
@@ -9549,8 +9550,8 @@
   resource link type has a default type defined, then the user agent
   must assume that the resource is of that type.</p>
 
-  <p class="note">The <code title="link-type-stylesheet">stylesheet</code> link type defines
-  rules for processing the resource's <a href="#content-type" title="Content-Type">Content-Type metadata</a>.</p>
+  <p class="note">The <code title="rel-stylesheet"><a href="#link-type-stylesheet">stylesheet</a></code>
+  link type defines rules for processing the resource's <a href="#content-type" title="Content-Type">Content-Type metadata</a>.</p>
 
   <p>Once the user agent has established the type of the resource, the
   user agent must apply the resource if it is of a supported type and
@@ -9650,7 +9651,7 @@
 &lt;link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF"&gt;
 &lt;link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"&gt;</pre>
 
-  </div><h4 id="meta"><span class="secno">4.2.5 </span>The <dfn><code>meta</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
+  </div><h4 id="meta"><span class="secno">4.2.5 </span>The <dfn><code>meta</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Controversial Working Draft</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#metadata-content">Metadata content</a>.</dd>
    <dd>If the <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute is present: <a href="#flow-content">flow content</a>.</dd>
    <dd>If the <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute is present: <a href="#phrasing-content">phrasing content</a>.</dd>
@@ -9719,7 +9720,7 @@
   same name. The IDL attribute <dfn id="dom-meta-httpequiv" title="dom-meta-httpEquiv"><code>httpEquiv</code></dfn> must
   <a href="#reflect">reflect</a> the content attribute <code title="attr-meta-http-equiv"><a href="#attr-meta-http-equiv">http-equiv</a></code>.</p>
 
-  </div><h5 id="standard-metadata-names"><span class="secno">4.2.5.1 </span>Standard metadata names</h5><p>This specification defines a few names for the <code title="attr-meta-name"><a href="#attr-meta-name">name</a></code> attribute of the
+  </div><h5 id="standard-metadata-names"><span class="secno">4.2.5.1 </span>Standard metadata names</h5><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><p>This specification defines a few names for the <code title="attr-meta-name"><a href="#attr-meta-name">name</a></code> attribute of the
   <code><a href="#meta">meta</a></code> element.<p>Names are case-insensitive<span class="impl">, and must be compared
   in an <a href="#ascii-case-insensitive">ASCII case-insensitive</a> manner</span>.<dl><dt><dfn id="meta-application-name" title="meta-application-name">application-name</dfn></dt>
 
@@ -9858,7 +9859,7 @@
 
   </div><p>Metadata names whose values are to be <a href="#url" title="URL">URLs</a> must not be proposed or accepted. Links must
   be represented using the <code><a href="#the-link-element">link</a></code> element, not the
-  <code><a href="#meta">meta</a></code> element.<h5 id="pragma-directives"><span class="secno">4.2.5.3 </span>Pragma directives</h5><p>When the <dfn id="attr-meta-http-equiv" title="attr-meta-http-equiv"><code>http-equiv</code></dfn> attribute
+  <code><a href="#meta">meta</a></code> element.<h5 id="pragma-directives"><span class="secno">4.2.5.3 </span>Pragma directives</h5><p class="XXX annotation"><b>Status: </b><i>Implemented and widely deployed</i><p>When the <dfn id="attr-meta-http-equiv" title="attr-meta-http-equiv"><code>http-equiv</code></dfn> attribute
   is specified on a <code><a href="#meta">meta</a></code> element, the element is a pragma
   directive.<p>The <code title="attr-meta-http-equiv"><a href="#attr-meta-http-equiv">http-equiv</a></code>
   attribute is an <a href="#enumerated-attribute">enumerated attribute</a>. The following
@@ -10209,7 +10210,7 @@
    </dd>
 
   </dl><p>There must not be more than one <code><a href="#meta">meta</a></code> element with
-  any particular state in the document at a time.<h5 id="other-pragma-directives"><span class="secno">4.2.5.4 </span>Other pragma directives</h5><p><dfn id="concept-http-equiv-extensions" title="concept-http-equiv-extensions">Extensions to the
+  any particular state in the document at a time.<h5 id="other-pragma-directives"><span class="secno">4.2.5.4 </span>Other pragma directives</h5><p class="XXX annotation"><b>Status: </b><i>Controversial Working Draft</i><p><dfn id="concept-http-equiv-extensions" title="concept-http-equiv-extensions">Extensions to the
   predefined set of pragma directives</dfn> may, under certain
   conditions, be registered in the <a href="http://wiki.whatwg.org/wiki/PragmaExtensions">WHATWG Wiki
   PragmaExtensions page</a>. <a href="#refsWHATWGWIKI">[WHATWGWIKI]</a><p>Such extensions must use a name that is identical to a
@@ -10251,7 +10252,7 @@
   (e.g. for performance reasons or to avoid the use of unreliable
   network connectivity).</p>
 
-  </div><h5 id="charset"><span class="secno">4.2.5.5 </span>Specifying the document's character encoding</h5><!-- READ ME WHEN EDITING: if we ever move this to the "writing
+  </div><h5 id="charset"><span class="secno">4.2.5.5 </span>Specifying the document's character encoding</h5><p class="XXX annotation"><b>Status: </b><i>Implemented and widely deployed</i></p><!-- READ ME WHEN EDITING: if we ever move this to the "writing
   HTML" section, then we have to duplicate the requirements in the
   parsing section for conformance checkers, and we have to make sure
   that the requirements for charset="" apply even in XML, for the
@@ -10333,7 +10334,7 @@
 
    <pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;</pre>
 
-  </div><h4 id="itemref"><span class="secno">4.2.6 </span>The <dfn><code>itemref</code></dfn> element</h4><dl class="element"><dt>Categories</dt>
+  </div><h4 id="itemref"><span class="secno">4.2.6 </span>The <dfn><code>itemref</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Controversial Working Draft</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#metadata-content">Metadata content</a>.</dd>
    <dd><a href="#flow-content">Flow content</a>.</dd>
    <dd><a href="#phrasing-content">Phrasing content</a>.</dd>
@@ -10364,7 +10365,7 @@
   attribute must <a href="#reflect">reflect</a> the content attribute of the
   same name.</p>
 
-  </div><h4 id="the-style-element"><span class="secno">4.2.7 </span>The <dfn><code>style</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
+  </div><h4 id="the-style-element"><span class="secno">4.2.7 </span>The <dfn><code>style</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#metadata-content">Metadata content</a>.</dd>
    <dd>If the <code title="attr-style-scoped"><a href="#attr-style-scoped">scoped</a></code> attribute is present: <a href="#flow-content">flow content</a>.</dd>
    <dt>Contexts in which this element may be used:</dt>
@@ -10403,11 +10404,7 @@
   user agents must not ignore unknown MIME parameters &mdash; types
   with unknown parameters must be assumed to be unsupported.</p>
 
-  </div><p>However, if the link is an <a href="#external-resource-link">external resource link</a>,
-  then the <code title="attr-link-media"><a href="#attr-link-media">media</a></code> attribute is
-  prescriptive.
-
-  <p>The <dfn id="attr-style-media" title="attr-style-media"><code>media</code></dfn>
+  </div><p>The <dfn id="attr-style-media" title="attr-style-media"><code>media</code></dfn>
   attribute says which media the styles apply to. The value must be a
   <a href="#valid-media-query">valid media query</a>.  <span class="impl">The user agent
   must apply the styles to a <a href="#view">view</a> when the <code title="attr-style-media"><a href="#attr-style-media">media</a></code> attribute's value
@@ -10462,23 +10459,32 @@
   when the processor is invoked.<!-- so dynamic changes to the base
   URL don't affect the CSS --></p>
 
-  <!-- the next paragraph is similar to text in the <link> section -->
-  <p>Once the element has been evaluated, if it had no subresources or
-  once all the subresources it uses have been <a href="#fetch" title="fetch">fetched</a>, the user agent must <a href="#queue-a-task">queue a
-  task</a> to <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-load">load</code> at the <code><a href="#the-style-element">style</a></code> element. If
-  the resource has a subresource that fails to completely load for any
-  reason (e.g. DNS error, HTTP 404 response, the connection being
-  prematurely closed, unsupported Content-Type), the user agent must
-  instead <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
-  event</a> named <code title="event-error">error</code> at the
-  <code><a href="#the-style-element">style</a></code> element. Non-network errors in the processing of
-  the element's contents or its subresources (e.g. CSS parse errors)
-  are not failures for the purposes of this paragraph. The
-  <code><a href="#the-style-element">style</a></code> element must <a href="#delay-the-load-event">delay the load event</a> of
-  the element's document until one of these <a href="#concept-task" title="concept-task">tasks</a> has been queued.</p>
+  <!-- the next few paragraph are similar to text in the <style> section -->
+  <p>Once the attempts to obtain the style sheet's critical
+  subresources, if any, are complete, or, if the style sheet has no
+  critical subresources, once the style sheet has been parsed and
+  processed, the user agent must, if the loads were successful or
+  there were none, <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
+  event</a> named <code title="event-load">load</code> at the
+  <code><a href="#the-style-element">style</a></code> element, or, if one of the style sheet's critical
+  subresources failed to completely load for any reason (e.g. DNS
+  error, HTTP 404 response, a connection being prematurely closed,
+  unsupported Content-Type), <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a
+  simple event</a> named <code title="event-error">error</code> at
+  the <code><a href="#the-style-element">style</a></code> element. Non-network errors in processing the
+  style sheet or its subresources (e.g. CSS parse errors, PNG decoding
+  errors) are not failures for the purposes of this paragraph.</p>
 
-  <p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#dom-manipulation-task-source">DOM manipulation
-  task source</a>.</p>
+  <p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#dom-manipulation-task-source">DOM manipulation task
+  source</a>.</p>
+
+  <p>The element must <a href="#delay-the-load-event">delay the load event</a> of the
+  element's document until all the attempts to obtain the style
+  sheet's critical subresources, if any, are complete.</p>
+
+  <p>Which resources are considered critical or not is defind by the
+  relevant specification. For CSS resources, only <code title="">@import</code> rules introduce critical subresources; other
+  resources, e.g. fonts or backgrounds, are not.</p>
 
   </div><p class="note">This specification does not specify a style system,
   but CSS is expected to be supported by most Web browsers. <a href="#refsCSS">[CSS]</a><div class="impl">
@@ -10514,7 +10520,7 @@
  &lt;/body&gt;
 &lt;/html&gt;</pre>
 
-  </div><h4 id="styling"><span class="secno">4.2.8 </span><dfn title="styling processing model">Styling</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><p>The <code><a href="#the-link-element">link</a></code> and <code><a href="#the-style-element">style</a></code> elements can provide
+  </div><h4 id="styling"><span class="secno">4.2.8 </span><dfn title="styling processing model">Styling</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><p>The <code><a href="#the-link-element">link</a></code> and <code><a href="#the-style-element">style</a></code> elements can provide
   styling information for the user agent to use when rendering the
   document. The DOM Styling specification specifies what styling
   information is to be used by the user agent and how it is to be
@@ -10597,6 +10603,35 @@
   <p id="alternate-style-sheets">The rules for handling alternative
   style sheets are defined in the CSS object model specification. <a href="#refsCSSOM">[CSSOM]</a></p>
 
+  <hr><p>Style sheets, whether added by a <code><a href="#the-link-element">link</a></code> element, a
+  <code><a href="#the-style-element">style</a></code> element, an <code>&lt;?xml-stylesheet&gt;</code> PI,
+  an HTTP <code title="http-link">Link:</code> header, or some other
+  mechanism, have a <dfn id="style-sheet-ready">style sheet ready</dfn> flag, which is
+  initially unset.</p>
+
+  <p>When a style sheet is ready to be applied, its <a href="#style-sheet-ready">style sheet
+  ready</a> flag must be set. If the style sheet referenced no
+  other resources (e.g. it was an internal style sheet given by a
+  <code><a href="#the-style-element">style</a></code> element with no <code title="">@import</code>
+  rules), then the style rules must be synchronously made available to
+  script; otherwise, the style rules must only be made available to
+  script once the <a href="#event-loop">event loop</a> reaches its "update the
+  rendering" step.</p>
+
+  <p>A style sheet in the context of the <code>Document</code> of an
+  <a href="#html-parser">HTML parser</a> or <a href="#xml-parser">XML parser</a> is said to be
+  <dfn id="a-style-sheet-blocking-scripts">a style sheet blocking scripts</dfn> if the element was created
+  by that <code>Document</code>'s parser, and the element is either a
+  <code><a href="#the-style-element">style</a></code> element or a <code><a href="#the-link-element">link</a></code> element that was
+  an <a href="#link-type-stylesheet" title="rel-stylesheet">external resource link that
+  contributes to the styling processing model</a> when the element
+  was created by the parser, and the element's style sheet was enabled
+  when the element was created by the parser, and the element's
+  <a href="#style-sheet-ready">style sheet ready</a> flag is not yet set, and, the last
+  time the <a href="#event-loop">event loop</a> reached step 1, the element was
+  <a href="#in-a-document" title="in a document">in that
+  <code>Document</code></a>.</p>
+
   </div><h3 id="scripting-1"><span class="secno">4.3 </span>Scripting</h3><p>Scripts allow authors to add interactivity to their documents.<p>Authors are encouraged to use declarative alternatives to
   scripting where possible, as declarative mechanisms are often more
   maintainable, and many users disable scripting.<div class="example">
@@ -10609,7 +10644,7 @@
    dynamically resort the table, the link could also be made to
    function without scripts by requesting the sorted table from the
    server.</p>
-  </div><h4 id="script"><span class="secno">4.3.1 </span>The <dfn><code>script</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Working draft</i><dl class="element"><dt>Categories</dt>
+  </div><h4 id="script"><span class="secno">4.3.1 </span>The <dfn><code>script</code></dfn> element</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><dl class="element"><dt>Categories</dt>
    <dd><a href="#metadata-content">Metadata content</a>.</dd>
    <dd><a href="#flow-content">Flow content</a>.</dd>
    <dd><a href="#phrasing-content">Phrasing content</a>.</dd>
@@ -10690,26 +10725,38 @@
   document</a><span class="impl">)</span>.</p><!-- by implication,
   changes to the base URL also have no effect --><div class="impl">
 
-  <p><code><a href="#script">script</a></code> elements have four associated pieces of
-  metadata. The first is a flag indicating whether or not the script
-  block has been <dfn id="already-executed">"already executed"</dfn>. Initially,
+  <p>A <code><a href="#script">script</a></code> element has several associated pieces of
+  state.</p>
+
+  <p>The first is a flag indicating whether or not the script block
+  has been <dfn id="already-started">"already started"</dfn>. Initially,
   <code><a href="#script">script</a></code> elements must have this flag unset (script
-  blocks, when created, are not "already executed"). When a
-  <code><a href="#script">script</a></code> element is cloned, the "already executed" flag,
-  if set, must be propagated to the clone when it is created. The
-  second is a flag indicating whether the element was
+  blocks, when created, are not "already started"). When a
+  <code><a href="#script">script</a></code> element is cloned, the "already started" flag,
+  if set, must be propagated to the clone when it is created.</p>
+
+  <p>The second is a flag indicating whether the element was
   <dfn id="parser-inserted">"parser-inserted"</dfn>. This flag is set by the <a href="#html-parser">HTML
-  parser</a> and is used to handle <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> calls. The third
-  and fourth pieces of metadata are <dfn id="the-script-block-s-type"><var>the script block's
-  type</var></dfn> and <dfn id="the-script-block-s-character-encoding"><var>the script block's character
+  parser</a> and is used to handle <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> calls.</p>
+
+  <p>The third is a flag indicating whether or not the script block is
+  <dfn id="ready-to-be-parser-executed">"ready to be parser-executed"</dfn>. Initially,
+  <code><a href="#script">script</a></code> elements must have this flag unset (script
+  blocks, when created, are not "ready to be parser-executed"). This
+  flag is used only for elements that are also
+  <a href="#parser-inserted">"parser-inserted"</a>, to let the parser know when to
+  execute the script.</p>
+
+  <p>The fourth and fifth pieces of state are <dfn id="the-script-block-s-type"><var>the script
+  block's type</var></dfn> and <dfn id="the-script-block-s-character-encoding"><var>the script block's character
   encoding</var></dfn>. They are determined when the script is run,
   based on the attributes on the element at that time.</p>
 
   <p>When a <code><a href="#script">script</a></code> element that is neither marked as
-  having <a href="#already-executed">"already executed"</a> nor marked as being
+  having <a href="#already-started">"already started"</a> nor marked as being
   <a href="#parser-inserted">"parser-inserted"</a> experiences one of the events listed
-  in the following list, the user agent must <a href="#running-a-script" title="running a
-  script">run</a> the <code><a href="#script">script</a></code> element:</p>
+  in the following list, the user agent must synchronously <a href="#running-a-script" title="running a script">run</a> the <code><a href="#script">script</a></code>
+  element:</p>
 
   <ul><li>The <code><a href="#script">script</a></code> element gets <a href="#insert-an-element-into-a-document" title="insert an
    element into a document">inserted into a document</a>.</li>
@@ -10790,8 +10837,8 @@
 
    <li>
 
-    <p>The user agent must set the element's <a href="#already-executed">"already
-    executed"</a> flag.</p>
+    <p>The user agent must set the element's <a href="#already-started">"already
+    started"</a> flag.</p>
 
    </li>
 
@@ -10817,13 +10864,6 @@
     user agent supports that encoding, then let <var><a href="#the-script-block-s-character-encoding">the script
     block's character encoding</a></var> be that encoding.</p>
 
-    <p>Once the fetching process has completed, and the script has
-    <dfn id="completed-loading">completed loading</dfn>, the user agent will have to complete
-    <a href="#when-a-script-completes-loading" title="when a script completes loading">the steps described
-    below</a>. (If the parser is still active at that time, those
-    steps defer to the parser to handle the execution of pending
-    scripts.)</p>
-
     <p>For performance reasons, user agents may start fetching the
     script as soon as the attribute is set, instead, in the hope that
     the element will be inserted into the document. Either way, once
@@ -10847,112 +10887,94 @@
      has been flagged as <a href="#parser-inserted">"parser-inserted"</a>, and the
      element does not have an <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute</dt>
 
-     <dd>The element must be added to the end of the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of
-     scripts that will execute when the document has finished
-     parsing</a>.</dd>
+     <dd>
 
+      <p>The element must be added to the end of the <dfn id="list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of
+      scripts that will execute when the document has finished
+      parsing</dfn>.</p>
 
-     <dt>If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code>
-     attribute, and the element has been flagged as
-     <a href="#parser-inserted">"parser-inserted"</a>, and the element does not have an
-     <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute</dt>
+      <p>The <a href="#concept-task" title="concept-task">task</a> that the
+      <a href="#networking-task-source">networking task source</a> places on the <a href="#task-queue">task
+      queue</a> once the <a href="#fetch" title="fetch">fetching
+      algorithm</a> has completed must set the element's
+      <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag. The parser will
+      handle executing the script.</p>
 
-     <dd>The element is the <dfn id="pending-external-script">pending external script</dfn>. (There
-     can only be one such script at a time.)</dd>
+     </dd>
 
 
      <dt>If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code>
-     attribute</dt>
-
-     <dd>The element must be added to the end of the <a href="#list-of-scripts-that-will-execute-as-soon-as-possible">list of
-     scripts that will execute as soon as possible</a>.</dd>
-
-
-     <dt>Otherwise</dt>
-
-     <dd>The user agent must immediately <a href="#executing-a-script-block" title="executing a
-     script block">execute the script block</a>, even if other
-     scripts are already executing.</dd>
-
-    </dl></li>
-
-  </ol><!-- similar text in various places --><p>Fetching an external script must <a href="#delay-the-load-event">delay the load
-  event</a> of the element's document until the <a href="#concept-task" title="concept-task">task</a> that is <a href="#queue-a-task" title="queue a
-  task">queued</a> by the <a href="#networking-task-source">networking task source</a> once
-  the resource has been <a href="#fetch" title="fetch">fetched</a> (defined
-  below) has been run.</p>
-
-  <p><dfn id="when-a-script-completes-loading">When a script completes loading</dfn>: The UA must run the
-  following steps as the <a href="#concept-task" title="concept-task">task</a> that
-  the <a href="#networking-task-source">networking task source</a> places on the <a href="#task-queue">task
-  queue</a>:</p>
-
-  <dl class="switch"><dt>If the <code><a href="#script">script</a></code> element was added to the <dfn id="list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list
-   of scripts that will execute when the document has finished
-   parsing</dfn>:</dt>
-
-   <dd>
-
-    <ol><li>
-
-      <p>If the script's <code>Document</code> is still being parsed,
-      then the parser handles it. Abort these steps.</p>
+     attribute, and the element has been flagged as
+     <a href="#parser-inserted">"parser-inserted"</a>, and the element does not have an
+     <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute, or</dt>
 
-     </li>
+     <dd>
 
-     <li>
+      <p>The element is the <a href="#pending-parsing-blocking-script">pending parsing-blocking
+      script</a>. (There can only be one such script at a
+      time.)</p>
 
-      <p>If the <code><a href="#script">script</a></code> element is not the first element
-      in the list, then do nothing yet. Stop going through these
-      steps.</p>
+      <p>The <a href="#concept-task" title="concept-task">task</a> that the
+      <a href="#networking-task-source">networking task source</a> places on the <a href="#task-queue">task
+      queue</a> once the <a href="#fetch" title="fetch">fetching
+      algorithm</a> has completed must set the element's
+      <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag. The parser will
+      handle executing the script.</p>
 
-     </li>
+     </dd>
 
-     <li>
 
-      <p>Otherwise, <a href="#executing-a-script-block" title="executing a script block">execute the
-      script block</a> (the first element in the list).</p>
+     <dt>If the element does not have a <code title="attr-script-src"><a href="#attr-script-src">src</a></code> attribute, but there is
+     <a href="#a-style-sheet-blocking-scripts">a style sheet blocking scripts</a>, and the element has
+     been flagged as <a href="#parser-inserted">"parser-inserted"</a></dt>
 
-     </li>
+     <dd>
 
-     <li>
+      <p>The element is the <a href="#pending-parsing-blocking-script">pending parsing-blocking
+      script</a>. (There can only be one such script at a
+      time.)</p>
 
-      <p>Remove the <code><a href="#script">script</a></code> element from the list
-      (i.e. shift out the first entry in the list).</p>
+      <p>Set the element's <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a>
+      flag. The parser will handle executing the script.</p>
 
-     </li>
+     </dd>
 
-     <li>
 
-      <p>If there are any more entries in the list, and if the script
-      associated with the element that is now the first in the list is
-      already loaded, then jump back to step 2 to execute it.</p>
+     <dt>If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code>
+     attribute</dt>
 
-     </li>
+     <dd>
 
-    </ol></dd>
+      <p>The element must be added to the end of the <dfn id="list-of-scripts-that-will-execute-as-soon-as-possible">list of
+      scripts that will execute as soon as possible</dfn>.</p>
 
-   <dt>If the <code><a href="#script">script</a></code> element was added to the <dfn id="list-of-scripts-that-will-execute-as-soon-as-possible">list
-   of scripts that will execute as soon as possible</dfn>:</dt>
+      <p>The <a href="#concept-task" title="concept-task">task</a> that the
+      <a href="#networking-task-source">networking task source</a> places on the <a href="#task-queue">task
+      queue</a> once the <a href="#fetch" title="fetch">fetching
+      algorithm</a> has completed must <a href="#executing-a-script-block" title="executing a
+      script block">execute the script block</a>.
 
-   <dd>
+     </dd>
 
-    <ol><li>
 
-      <p><a href="#executing-a-script-block" title="executing a script block">Execute the
-      script block</a>.</p>
-
-     </li>
+     <dt>Otherwise</dt>
 
-     <li>
+     <dd>The user agent must immediately <a href="#executing-a-script-block" title="executing a
+     script block">execute the script block</a>, even if other
+     scripts are already executing.</dd>
 
-      <p>Remove the <code><a href="#script">script</a></code> element from the list.</p>
+    </dl></li>
 
-     </li>
+  </ol><!-- similar text in various places --><p>Fetching an external script must <a href="#delay-the-load-event">delay the load
+  event</a> of the element's document until the <a href="#concept-task" title="concept-task">task</a> that is <a href="#queue-a-task" title="queue a
+  task">queued</a> by the <a href="#networking-task-source">networking task source</a> once
+  the resource has been <a href="#fetch" title="fetch">fetched</a> (defined
+  above) has been run.</p>
 
-    </ol></dd>
+  <p>The <dfn id="pending-parsing-blocking-script">pending parsing-blocking script</dfn> is used by the
+  parser.</p>
 
-  </dl><p><dfn id="executing-a-script-block" title="executing a script block">Executing a script
+  <p><dfn id="executing-a-script-block" title="executing a script block">Executing a script
   block</dfn>: When the steps above require that the script block be
   executed, the user agent must act as follows:</p>
 
@@ -42680,6 +42702,27 @@
    <li><p>Return to the first step of the <a href="#event-loop">event
    loop</a>.</li>
 
+  </ol><hr><p>When an algorithm says to <dfn id="spin-the-event-loop">spin the event loop</dfn> until
+  a condition <var title="">goal</var> is met, the user agent must run
+  the following steps:</p>
+
+  <ol><li><p>Let <var title="">task source</var> be the <a href="#task-source">task
+   source</a> of the currently running <a href="#concept-task" title="concept-task">task</a>.</li>
+
+   <li><p>Stop the currently running <a href="#concept-task" title="concept-task">task</a>, allowing the <a href="#event-loop">event
+   loop</a> to resume, but continue these steps
+   asynchronously.</li>
+
+   <li><p>Wait until the condition <var title="">goal</var> is
+   met.</li>
+
+   <li><p><a href="#queue-a-task">Queue a task</a> to continue running these steps,
+   using the <a href="#task-source">task source</a> <var title="">task
+   source</var>. Wait until this task runs before continuing these
+   steps.</li>
+
+   <li><p>Return to the caller.</li>
+
   </ol><hr><p>Some of the algorithms in this specification, for historical
   reasons, require the user agent to <dfn id="pause">pause</dfn> while running a
   <a href="#concept-task" title="concept-task">task</a> until some condition has been
@@ -56973,8 +57016,8 @@
 
      <li><p>If the parser was originally created for the <a href="#html-fragment-parsing-algorithm">HTML
      fragment parsing algorithm</a>, then mark the
-     <code><a href="#script">script</a></code> element as <a href="#already-executed">"already
-     executed"</a>. (<a href="#fragment-case">fragment case</a>)</li>
+     <code><a href="#script">script</a></code> element as <a href="#already-started">"already
+     started"</a>. (<a href="#fragment-case">fragment case</a>)</li>
 
      <li><p>Append the new element to the <a href="#current-node">current node</a>
      and push it onto the <a href="#stack-of-open-elements">stack of open
@@ -58407,8 +58450,8 @@
     <p><a href="#parse-error">Parse error</a>.</p>
 
     <p>If the <a href="#current-node">current node</a> is a <code><a href="#script">script</a></code>
-    element, mark the <code><a href="#script">script</a></code> element as <a href="#already-executed">"already
-    executed"</a>.</p>
+    element, mark the <code><a href="#script">script</a></code> element as <a href="#already-started">"already
+    started"</a>.</p>
 
     <p>Pop the <a href="#current-node">current node</a> off the <a href="#stack-of-open-elements">stack of open
     elements</a>.</p>
@@ -58452,7 +58495,7 @@
     might be the "undefined" value.)</p>
 
     <p id="scriptTagParserResumes">At this stage, if there is a
-    <a href="#pending-external-script">pending external script</a>, then:</p>
+    <a href="#pending-parsing-blocking-script">pending parsing-blocking script</a>, then:</p>
 
     <dl class="switch"><dt>If the <a href="#script-nesting-level">script nesting level</a> is not zero:</dt>
 
@@ -58476,12 +58519,22 @@
 
       <p>Follow these steps:</p>
 
-      <ol><li><p>Let <var title="">the script</var> be the <a href="#pending-external-script">pending
-       external script</a>. There is no longer a <a href="#pending-external-script">pending
-       external script</a>.</li>
+      <ol><li><p>Let <var title="">the script</var> be the <a href="#pending-parsing-blocking-script">pending
+       parsing-blocking script</a>. There is no longer a <a href="#pending-parsing-blocking-script">pending
+       parsing-blocking script</a>.</li>
 
-       <li><p><a href="#pause">Pause</a> until the script has <a href="#completed-loading">completed
-       loading</a>.</li>
+       <li><p>Block the <a href="#tokenization" title="tokenization">tokenizer</a>
+       for this instance of the <a href="#html-parser">HTML parser</a>, such that
+       the <a href="#event-loop">event loop</a> will not run <a href="#concept-task" title="concept-task">tasks</a> that invoke the <a href="#tokenization" title="tokenization">tokenizer</a>.</li>
+
+       <li><p><a href="#spin-the-event-loop">Spin the event loop</a> until there is no <a href="#a-style-sheet-blocking-scripts" title="a style sheet blocking scripts">style sheet blocking
+       scripts</a> and <var title="">the script</var>'s
+       <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag is set.</li>
+
+       <li><p>Unblock the <a href="#tokenization" title="tokenization">tokenizer</a>
+       for this instance of the <a href="#html-parser">HTML parser</a>, such that
+       <a href="#concept-task" title="concept-task">tasks</a> that invoke the <a href="#tokenization" title="tokenization">tokenizer</a> can again be
+       run.</li>
 
        <li><p>Let the <a href="#insertion-point">insertion point</a> be just before the
        <a href="#next-input-character">next input character</a>.</li>
@@ -58490,8 +58543,8 @@
        by one (it should be zero before this step, so this sets it to
        one).</li>
 
-       <li><p><a href="#executing-a-script-block" title="executing a script block">Execute the
-       script</a>.</li>
+       <li><p><a href="#executing-a-script-block" title="executing a script block">Execute</a>
+       <var title="">the script</var>.</li>
 
        <li><p>Decrement the parser's <a href="#script-nesting-level">script nesting level</a>
        by one. If the parser's <a href="#script-nesting-level">script nesting level</a> is
@@ -58501,7 +58554,7 @@
        <li><p>Let the <a href="#insertion-point">insertion point</a> be undefined
        again.</li>
 
-       <li><p>If there is once again a <a href="#pending-external-script">pending external
+       <li><p>If there is once again a <a href="#pending-parsing-blocking-script">pending parsing-blocking
        script</a>, then repeat these steps from step 1.</li>
 
       </ol></dd>
@@ -59808,53 +59861,55 @@
   <h4 id="the-end"><span class="secno">9.2.6 </span>The end</h4>
 
   <p>Once the user agent <dfn id="stop-parsing" title="stop parsing">stops parsing</dfn>
-  the document, the user agent must follow the steps in this
-  section.</p>
+  the document, the user agent must run the following steps:</p>
 
-  <!-- this happens as part of one of the tasks that runs the parser -->
+  <ol><!-- this happens as part of one of the tasks that runs the parser --><li><p>Set the <a href="#current-document-readiness">current document readiness</a> to
+   "interactive" <!-- this also synchronously fires an event --> and
+   the <a href="#insertion-point">insertion point</a> to undefined.</li>
 
-  <p>First, the user agent must set the <a href="#current-document-readiness">current document
-  readiness</a> to "interactive" and the <a href="#insertion-point">insertion
-  point</a> to undefined.</p> <!-- this also synchronously fires an
-  event -->
+   <li><p>If the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will execute when the
+   document has finished parsing</a> is not empty, run these
+   substeps:</p>
 
-  <p>Then, the user agent must then make a list of all the scripts
-  that are in the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will execute when the
-  document has finished parsing</a> and the <a href="#list-of-scripts-that-will-execute-as-soon-as-possible">list of scripts
-  that will execute as soon as possible</a>. This is the <dfn id="list-of-scripts-pending-after-the-parser-stopped">list
-  of scripts pending after the parser stopped</dfn>.</p>
+    <ol><li><p><a href="#spin-the-event-loop">Spin the event loop</a> until the first
+     <code><a href="#script">script</a></code> in the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will
+     execute when the document has finished parsing</a> has its
+     <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag set <em>and</em> there
+     is no <a href="#a-style-sheet-blocking-scripts" title="a style sheet blocking scripts">style sheet
+     blocking scripts</a>.</li>
 
-  <p>The document is no longer being parsed, so the rules for
-  <a href="#when-a-script-completes-loading">when a script completes loading</a> for the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of
-  scripts that will execute when the document has finished
-  parsing</a> start applying (script execution for that list is no
-  longer managed by the parser).</p>
+     <li><p><a href="#executing-a-script-block" title="executing a script block">Execute</a> the
+     first <code><a href="#script">script</a></code> in the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will
+     execute when the document has finished parsing</a>.</li>
 
-  <p>If the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will execute when the document
-  has finished parsing</a> is not empty, and the first item in this
-  list has already <a href="#completed-loading">completed loading</a>, then the user agent
-  must act as if that script just finished loading.</p>
+     <li><p>Remove the first <code><a href="#script">script</a></code> element from the
+     <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will execute when the document has
+     finished parsing</a> (i.e. shift out the first entry in the
+     list).</li>
+ 
+     <li><p>If the <a href="#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing">list of scripts that will execute when the
+     document has finished parsing</a> is still not empty, repeat
+     these substeps again from substep 1.</p>
 
-  <p class="note">By this point, there will be no scripts that have
-  loaded but have not yet been executed.</p>
+    </ol></li>
 
-  <hr><!-- async --><p>Once all the scripts on the <a href="#list-of-scripts-pending-after-the-parser-stopped">list of scripts pending after
-  the parser stopped</a> have <a href="#completed-loading">completed loading</a> and
-  been <a href="#executing-a-script-block" title="executing a script block">executed</a>, the
-  user agent must <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple
-  event</a> named <code title="event-DOMContentLoaded">DOMContentLoaded</code> at the
-  <code>Document</code>. (If the list is empty, this happens
-  immediately.)</p>
+   <li><p><a href="#spin-the-event-loop">Spin the event loop</a> until the the <a href="#list-of-scripts-that-will-execute-as-soon-as-possible">list of
+   scripts that will execute as soon as possible</a> is
+   empty.</li>
 
-  <hr><!-- async --><p>Once everything that <dfn id="delay-the-load-event" title="delay the load event">delays the
-  load event</dfn> of the document has completed, the user agent must
-  run the following steps:</p>
+   <li><p><a href="#queue-a-task">Queue a task</a> to <a href="#fire-a-simple-event">fire a simple
+   event</a> named <code title="event-DOMContentLoaded">DOMContentLoaded</code> at the
+   <code>Document</code>.</li>
 
-  <ol><li><a href="#queue-a-task">Queue a task</a> to set the <a href="#current-document-readiness">current document
-   readiness</a> to "complete".</li> <!-- this also fires an event
-   synchronously during the task -->
+   <li><p><a href="#spin-the-event-loop">Spin the event loop</a> until there is nothing that
+   <dfn id="delay-the-load-event" title="delay the load event">delays the load event</dfn> in
+   the <code>Document</code>.</li>
 
-   <li>If the <code>Document</code> is in a <a href="#browsing-context">browsing
+   <li><p><a href="#queue-a-task">Queue a task</a> to set the <a href="#current-document-readiness">current document
+   readiness</a> to "complete". <!-- this also fires an event
+   synchronously during the task --></li>
+
+   <li><p>If the <code>Document</code> is in a <a href="#browsing-context">browsing
    context</a>, then <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a
    simple event</a> named <code title="event-load">load</code> at
    the <code>Document</code>'s <code><a href="#window">Window</a></code> object, but with
@@ -59862,15 +59917,16 @@
    <code>Document</code> object (and the <code title="dom-event-currentTarget">currentTarget</code> set to the
    <code><a href="#window">Window</a></code> object).</li>
 
-   <li>If the <code>Document</code> has a <a href="#pending-state-object">pending state
+   <li><p>If the <code>Document</code> has a <a href="#pending-state-object">pending state
    object</a>, then <a href="#queue-a-task">queue a task</a> to fire a <code title="event-popstate"><a href="#event-popstate">popstate</a></code> event in no namespace on the
    <code>Document</code>'s <code><a href="#window">Window</a></code> object using the
    <code><a href="#popstateevent">PopStateEvent</a></code> interface, with the <code title="dom-PopStateEvent-state"><a href="#dom-popstateevent-state">state</a></code> attribute set to the
    current value of the <a href="#pending-state-object">pending state object</a>. This event
-   must bubble but not be cancelable and has no default action.</li>
+   must bubble but not be cancelable and has no default
+   action.</li>
 
-  </ol><p>The <a href="#task-source">task source</a> for these <a href="#concept-task" title="concept-task">tasks</a> is the <a href="#dom-manipulation-task-source">DOM manipulation
-  task source</a>.</p>
+  </ol><p>The <a href="#task-source">task source</a> for the <a href="#concept-task" title="concept-task">tasks</a> mentioned in this section is the
+  <a href="#dom-manipulation-task-source">DOM manipulation task source</a>.</p>
 
   </div><div class="impl">
 
@@ -62778,15 +62834,31 @@
   element, it must be marked as being <a href="#parser-inserted">"parser-inserted"</a>.
   If the parser was originally created for the <a href="#xml-fragment-parsing-algorithm">XML fragment
   parsing algorithm</a>, then the element must be marked as
-  <a href="#already-executed">"already executed"</a> also. When the element's end tag is
+  <a href="#already-started">"already started"</a> also. When the element's end tag is
   parsed, the user agent must <a href="#running-a-script" title="running a
   script">run</a> the <code><a href="#script">script</a></code> element. If this causes
-  there to be a <a href="#pending-external-script">pending external script</a>, then the user
-  agent must <a href="#pause">pause</a> until that script has <a href="#completed-loading">completed
-  loading</a>, and then <a href="#executing-a-script-block" title="executing a script
-  block">execute it</a>.</p>
+  there to be a <a href="#pending-parsing-blocking-script">pending parsing-blocking script</a>, then the
+  user agent must run the following steps:</p>
 
-  <p class="note">Since the <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> API is not
+  <ol><li><p>Block this instance of the <a href="#xml-parser">XML parser</a>, such
+   that the <a href="#event-loop">event loop</a> will not run <a href="#concept-task" title="concept-task">tasks</a> that invoke it.</li>
+
+   <li><p><a href="#spin-the-event-loop">Spin the event loop</a> until there is no <a href="#a-style-sheet-blocking-scripts" title="a style sheet blocking scripts">style sheet blocking
+   scripts</a> and the <a href="#pending-parsing-blocking-script">pending parsing-blocking
+   script</a>'s <a href="#ready-to-be-parser-executed">"ready to be parser-executed"</a> flag is
+   set.</li>
+
+   <li><p>Unblock this instance of the <a href="#xml-parser">XML parser</a>, such
+   that <a href="#concept-task" title="concept-task">tasks</a> that invoke it can
+   again be run.</li>
+
+   <li><p><a href="#executing-a-script-block" title="executing a script block">Execute</a> the
+   <a href="#pending-parsing-blocking-script">pending parsing-blocking script</a>.</li>
+
+   <li><p>There is no longer a <a href="#pending-parsing-blocking-script">pending parsing-blocking
+   script</a>.</li>
+
+  </ol><p class="note">Since the <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code> API is not
   available for <a href="#xml-documents">XML documents</a>, much of the complexity in
   the <a href="#html-parser">HTML parser</a> is not needed in the <a href="#xml-parser">XML
   parser</a>.</p>

Received on Sunday, 11 October 2009 07:52:16 UTC