W3C home > Mailing lists > Public > public-html-diffs@w3.org > February 2011

hixie: Make script-inserted external scripts that have .async=false execute in the insertion order, default to true (whatwg r5817)

From: poot <cvsmail@w3.org>
Date: Thu, 03 Feb 2011 00:36:06 -0500
To: public-html-diffs@w3.org
Message-Id: <E1PkrrR-0007Fh-UH@jay.w3.org>
hixie: Make script-inserted external scripts that have .async=false
execute in the insertion order, default to true (whatwg r5817)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4675&r2=1.4676&f=h
http://html5.org/tools/web-apps-tracker?from=5816&to=5817

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4675
retrieving revision 1.4676
diff -u -d -r1.4675 -r1.4676
--- Overview.html	2 Feb 2011 00:25:00 -0000	1.4675
+++ Overview.html	3 Feb 2011 05:34:48 -0000	1.4676
@@ -343,7 +343,7 @@
 
    <h1>HTML5</h1>
    <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>
-   <h2 class="no-num no-toc" id="editor-s-draft-2-february-2011">Editor's Draft 2 February 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-3-february-2011">Editor's Draft 3 February 2011</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -478,7 +478,7 @@
   Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation
   track.
-  This specification is the 2 February 2011 Editor's Draft.
+  This specification is the 3 February 2011 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>Work on this specification is also done at the <a href="http://www.whatwg.org/">WHATWG</a>. The W3C HTML working group
   actively pursues convergence with the WHATWG, as required by the <a href="http://www.w3.org/2007/03/HTML-WG-charter">W3C HTML working
   group charter</a>.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- required patent boilerplate --><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
@@ -12847,7 +12847,17 @@
   elements they insert and affects the processing of those
   elements.</p>
 
-  <p>The third is a flag indicating whether or not the script block is
+  <p>The third is a flag indicating whether the element will
+  <dfn id="force-async">"force-async"</dfn>. Initially, <code><a href="#script">script</a></code> elements
+  must have this flag set. It is unset by the <a href="#html-parser">HTML parser</a>
+  and the <a href="#xml-parser">XML parser</a> on <code><a href="#script">script</a></code> elements they
+  insert. In addition, whenever a <code><a href="#script">script</a></code> element whose
+  <a href="#force-async">"force-async"</a> flag is set has a <code title="attr-script-async"><a href="#attr-script-async">async</a></code> content attribute added, the
+  element's <a href="#force-async">"force-async"</a> flag must be unset.</p> <!--
+  there's no need to unset it when the attribute is removed since you
+  can't have the attribute and the flag set at once. -->
+
+  <p>The fourth 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
@@ -12906,6 +12916,21 @@
 
    </li>
 
+   <li>
+
+    <p>If <var title="">was-parser-inserted</var> is true and the
+    element does not have an <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute, then set the
+    element's <a href="#force-async">"force-async"</a> flag to true.</p>
+
+    <p class="note">This is done so that if a parser-inserted
+    <code><a href="#script">script</a></code> element fails to run when the parser tries to
+    run it, but it is later executed after a script dynamically
+    updates it, it will execute asynchronously even if the
+    <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute isn't
+    set.</p>
+
+   </li>
+
    <li id="script-processing-empty">
 
     <p>If the element has no <code title="attr-script-src"><a href="#attr-script-src">src</a></code>
@@ -12965,17 +12990,18 @@
 
    </li>
 
-   <li id="script-processing-start">
+   <li>
 
-    <p>The user agent must set the element's <a href="#already-started">"already
-    started"</a> flag.</p>
+    <p>If <var title="">was-parser-inserted</var> is true, then flag
+    the element as <a href="#parser-inserted">"parser-inserted"</a> again, and set the
+    element's <a href="#force-async">"force-async"</a> flag to false.</p>
 
    </li>
 
-   <li>
+   <li id="script-processing-start">
 
-    <p>If <var title="">was-parser-inserted</var> is true, then flag
-    the element as <a href="#parser-inserted">"parser-inserted"</a> again.</p>
+    <p>The user agent must set the element's <a href="#already-started">"already
+    started"</a> flag.</p>
 
    </li>
 
@@ -13061,6 +13087,9 @@
 
    </li>
 
+   <!-- at this point if the element is "parser-inserted" then we know
+   it is not "force-async". -->
+
    <li>
 
     <p>Then, the first of the following options that describes the
@@ -13131,6 +13160,45 @@
      </dd>
 
 
+     <dt id="script-processing-src-sync">If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code> attribute, does not have an
+     <code title="attr-script-async"><a href="#attr-script-async">async</a></code> attribute, and does
+     not have the <a href="#force-async">"force-async"</a> flag set</dt>
+
+     <dd>
+
+      <p>The element must be added to the end of the <dfn id="list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of
+      scripts that will execute in order as soon as possible</dfn>
+      associated with the <code><a href="#document">Document</a></code> of the
+      <code><a href="#script">script</a></code> element at the time the <a href="#running-a-script">running a
+      script</a> algorithm started.</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 run the following steps:</p>
+
+      <ol><li><p>If the element is not now the first element in the
+       <a href="#list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of scripts that will execute in order as soon as
+       possible</a> to which it was added above, then mark the
+       element as ready but abort these steps without executing the
+       script yet.</li>
+
+       <li><p><i>Execution</i>: <a href="#executing-a-script-block" title="executing a script
+       block">Execute the script block</a> corresponding to the
+       first script element in this <a href="#list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of scripts that will
+       execute in order as soon as possible</a>.</li>
+
+       <li><p>Remove the first element from this <a href="#list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of scripts
+       that will execute in order as soon as possible</a>.</li>
+
+       <li><p>If this <a href="#list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of scripts that will execute in order
+       as soon as possible</a> is still not empty and the first
+       entry has already been marked as ready, then jump back to the
+       step labeled <i>execution</i>.</li>
+
+      </ol></dd>
+
+
      <dt id="script-processing-src">If the element has a <code title="attr-script-src"><a href="#attr-script-src">src</a></code> attribute</dt>
 
      <dd>
@@ -13356,10 +13424,22 @@
 
     </ol></dd>
 
-  </dl><p>The IDL attributes <dfn id="dom-script-src" title="dom-script-src"><code>src</code></dfn>, <dfn id="dom-script-type" title="dom-script-type"><code>type</code></dfn>, <dfn id="dom-script-charset" title="dom-script-charset"><code>charset</code></dfn>, <dfn id="dom-script-async" title="dom-script-async"><code>async</code></dfn>, and <dfn id="dom-script-defer" title="dom-script-defer"><code>defer</code></dfn>, each must
+  </dl><p>The IDL attributes <dfn id="dom-script-src" title="dom-script-src"><code>src</code></dfn>, <dfn id="dom-script-type" title="dom-script-type"><code>type</code></dfn>, <dfn id="dom-script-charset" title="dom-script-charset"><code>charset</code></dfn>, and <dfn id="dom-script-defer" title="dom-script-defer"><code>defer</code></dfn>, each must
   <a href="#reflect">reflect</a> the respective content attributes of the same
   name.</p>
 
+  <p>The <dfn id="dom-script-async" title="dom-script-async"><code>async</code></dfn> IDL
+  attribute controls whether the element will execute asynchronously
+  or not. If the element's <a href="#force-async">"force-async"</a> flag is set,
+  then, on getting, the <code title="dom-script-async"><a href="#dom-script-async">async</a></code>
+  IDL attribute must return true, and on setting, the
+  <a href="#force-async">"force-async"</a> flag must first be unset, and then the
+  content attribute must be removed if the IDL attribute's new value
+  is false, and must be set to the empty string if the IDL attribute's
+  new value is true. If the element's <a href="#force-async">"force-async"</a> flag
+  is <em>not</em> set, the IDL attribute must <a href="#reflect">reflect</a> the
+  <code title="attr-script-async"><a href="#attr-script-async">async</a></code> content attribute.</p>
+
   </div><dl class="domintro"><dt><var title="">script</var> . <code title="dom-script-text"><a href="#dom-script-text">text</a></code> [ = <var title="">value</var> ]</dt>
 
    <dd>
@@ -58754,7 +58834,8 @@
 
      <li>
 
-      <p>Mark the element as being <a href="#parser-inserted">"parser-inserted"</a>.</p>
+      <p>Mark the element as being <a href="#parser-inserted">"parser-inserted"</a> and
+      unset the element's <a href="#force-async">"force-async"</a> flag.</p>
 
       <p class="note">This ensures that, if the script is external,
       any <code title="dom-document-write"><a href="#dom-document-write">document.write()</a></code>
@@ -61828,11 +61909,14 @@
    <code><a href="#document">Document</a></code>.</li>
 
    <li><p><a href="#spin-the-event-loop">Spin the event loop</a> until the <a href="#set-of-scripts-that-will-execute-as-soon-as-possible">set of
-   scripts that will execute as soon as possible</a> is
-   empty.</li> <!-- this step is redundant with the next one,
-   really, since all those scripts also delay the load event. It's
-   here in case we add an event between this step and the next or if
-   we move the previous step (DOMContentLoaded) down again. -->
+   scripts that will execute as soon as possible</a> and the
+   <a href="#list-of-scripts-that-will-execute-in-order-as-soon-as-possible">list of scripts that will execute in order as soon as
+   possible</a> are empty.</li> <!-- this step is not redundant
+   with the next one, since <script type="text/javascript"> nodes delay the load event of the
+   document they are in, but they might change document between being
+   added to one document's set/list and executing those scripts, so
+   they might be delaying another document but still be in this
+   document's set/list. -->
 
    <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
@@ -62794,13 +62878,14 @@
 
   <p id="scriptTagXML">When an <a href="#xml-parser">XML parser</a> creates a
   <code><a href="#script">script</a></code> 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-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-parsing-blocking-script">pending parsing-blocking
-  script</a>, then the user agent must run the following steps:</p>
+  <a href="#parser-inserted">"parser-inserted"</a> and its <a href="#force-async">"force-async"</a>
+  flag must be unset. 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-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-parsing-blocking-script">pending parsing-blocking script</a>, then the
+  user agent must run the following steps:</p>
 
   <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>
Received on Thursday, 3 February 2011 05:36:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 February 2011 05:36:08 GMT