[html5] r5817 - [agiow] (0) Make script-inserted external scripts that have .async=false execute [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Feb 2 21:34:44 PST 2011


Author: ianh
Date: 2011-02-02 21:34:43 -0800 (Wed, 02 Feb 2011)
New Revision: 5817

Modified:
   complete.html
   index
   source
Log:
[agiow] (0) Make script-inserted external scripts that have .async=false execute in the insertion order, default to true
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=11295

Modified: complete.html
===================================================================
--- complete.html	2011-02-02 00:24:53 UTC (rev 5816)
+++ complete.html	2011-02-03 05:34:43 UTC (rev 5817)
@@ -239,7 +239,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 2 February 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 3 February 2011</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -14883,7 +14883,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
@@ -14942,6 +14952,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>
@@ -15001,17 +15026,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>
 
@@ -15097,6 +15123,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
@@ -15167,6 +15196,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>
@@ -15392,10 +15460,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>
@@ -80953,7 +81033,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>
@@ -84030,11 +84111,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> 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
@@ -85032,13 +85116,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>

Modified: index
===================================================================
--- index	2011-02-02 00:24:53 UTC (rev 5816)
+++ index	2011-02-03 05:34:43 UTC (rev 5817)
@@ -243,7 +243,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 2 February 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 3 February 2011</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -14862,7 +14862,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
@@ -14921,6 +14931,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>
@@ -14980,17 +15005,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>
 
@@ -15076,6 +15102,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
@@ -15146,6 +15175,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>
@@ -15371,10 +15439,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>
@@ -76929,7 +77009,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>
@@ -80006,11 +80087,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> 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
@@ -81008,13 +81092,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>

Modified: source
===================================================================
--- source	2011-02-02 00:24:53 UTC (rev 5816)
+++ source	2011-02-03 05:34:43 UTC (rev 5817)
@@ -15760,7 +15760,18 @@
   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>"force-async"</dfn>. Initially, <code>script</code> elements
+  must have this flag set. It is unset by the <span>HTML parser</span>
+  and the <span>XML parser</span> on <code>script</code> elements they
+  insert. In addition, whenever a <code>script</code> element whose
+  <span>"force-async"</span> flag is set has a <code
+  title="attr-script-async">async</code> content attribute added, the
+  element's <span>"force-async"</span> 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>"ready to be parser-executed"</dfn>. Initially,
   <code>script</code> elements must have this flag unset (script
   blocks, when created, are not "ready to be parser-executed"). This
@@ -15827,6 +15838,22 @@
 
    </li>
 
+   <li>
+
+    <p>If <var title="">was-parser-inserted</var> is true and the
+    element does not have an <code
+    title="attr-script-async">async</code> attribute, then set the
+    element's <span>"force-async"</span> flag to true.</p>
+
+    <p class="note">This is done so that if a parser-inserted
+    <code>script</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">async</code> attribute isn't
+    set.</p>
+
+   </li>
+
    <li id="script-processing-empty">
 
     <p>If the element has no <code title="attr-script-src">src</code>
@@ -15902,17 +15929,18 @@
 
    </li>
 
-   <li id="script-processing-start">
+   <li>
 
-    <p>The user agent must set the element's <span>"already
-    started"</span> flag.</p>
+    <p>If <var title="">was-parser-inserted</var> is true, then flag
+    the element as <span>"parser-inserted"</span> again, and set the
+    element's <span>"force-async"</span> 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 <span>"parser-inserted"</span> again.</p>
+    <p>The user agent must set the element's <span>"already
+    started"</span> flag.</p>
 
    </li>
 
@@ -16013,6 +16041,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
@@ -16088,6 +16119,50 @@
      </dd>
 
 
+     <dt id="script-processing-src-sync">If the element has a <code
+     title="attr-script-src">src</code> attribute, does not have an
+     <code title="attr-script-async">async</code> attribute, and does
+     not have the <span>"force-async"</span> flag set</dt>
+
+     <dd>
+
+      <p>The element must be added to the end of the <dfn>list of
+      scripts that will execute in order as soon as possible</dfn>
+      associated with the <code>Document</code> of the
+      <code>script</code> element at the time the <span>running a
+      script</span> algorithm started.</p>
+
+      <p>The <span title="concept-task">task</span> that the
+      <span>networking task source</span> places on the <span>task
+      queue</span> once the <span title="fetch">fetching
+      algorithm</span> has completed must run the following steps:</p>
+
+      <ol>
+
+       <li><p>If the element is not now the first element in the
+       <span>list of scripts that will execute in order as soon as
+       possible</span> to which it was added above, then mark the
+       element as ready but abort these steps without executing the
+       script yet.</p></li>
+
+       <li><p><i>Execution</i>: <span title="executing a script
+       block">Execute the script block</span> corresponding to the
+       first script element in this <span>list of scripts that will
+       execute in order as soon as possible</span>.</p></li>
+
+       <li><p>Remove the first element from this <span>list of scripts
+       that will execute in order as soon as possible</span>.</p></li>
+
+       <li><p>If this <span>list of scripts that will execute in order
+       as soon as possible</span> is still not empty and the first
+       entry has already been marked as ready, then jump back to the
+       step labeled <i>execution</i>.</p></li>
+
+      </ol>
+
+     </dd>
+
+
      <dt id="script-processing-src">If the element has a <code
      title="attr-script-src">src</code> attribute</dt>
 
@@ -16354,12 +16429,23 @@
   <p>The IDL attributes <dfn
   title="dom-script-src"><code>src</code></dfn>, <dfn
   title="dom-script-type"><code>type</code></dfn>, <dfn
-  title="dom-script-charset"><code>charset</code></dfn>, <dfn
-  title="dom-script-async"><code>async</code></dfn>, and <dfn
+  title="dom-script-charset"><code>charset</code></dfn>, and <dfn
   title="dom-script-defer"><code>defer</code></dfn>, each must
   <span>reflect</span> the respective content attributes of the same
   name.</p>
 
+  <p>The <dfn title="dom-script-async"><code>async</code></dfn> IDL
+  attribute controls whether the element will execute asynchronously
+  or not. If the element's <span>"force-async"</span> flag is set,
+  then, on getting, the <code title="dom-script-async">async</code>
+  IDL attribute must return true, and on setting, the
+  <span>"force-async"</span> 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 <span>"force-async"</span> flag
+  is <em>not</em> set, the IDL attribute must <span>reflect</span> the
+  <code title="attr-script-async">async</code> content attribute.</p>
+
   </div>
 
   <dl class="domintro">
@@ -91728,7 +91814,8 @@
 
      <li>
 
-      <p>Mark the element as being <span>"parser-inserted"</span>.</p>
+      <p>Mark the element as being <span>"parser-inserted"</span> and
+      unset the element's <span>"force-async"</span> flag.</p>
 
       <p class="note">This ensures that, if the script is external,
       any <code title="dom-document-write">document.write()</code>
@@ -95099,11 +95186,14 @@
    <code>Document</code>.</p></li>
 
    <li><p><span>Spin the event loop</span> until the <span>set of
-   scripts that will execute as soon as possible</span> is
-   empty.</p></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</span> and the
+   <span>list of scripts that will execute in order as soon as
+   possible</span> are empty.</p></li> <!-- this step is not redundant
+   with the next one, since <script> 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><span>Spin the event loop</span> until there is nothing that
    <dfn title="delay the load event">delays the load event</dfn> in
@@ -96255,13 +96345,14 @@
 
   <p id="scriptTagXML">When an <span>XML parser</span> creates a
   <code>script</code> element, it must be marked as being
-  <span>"parser-inserted"</span>.  If the parser was originally
-  created for the <span>XML fragment parsing algorithm</span>, then
-  the element must be marked as <span>"already started"</span>
-  also. When the element's end tag is parsed, the user agent must
-  <span title="running a script">run</span> the <code>script</code>
-  element. If this causes there to be a <span>pending parsing-blocking
-  script</span>, then the user agent must run the following steps:</p>
+  <span>"parser-inserted"</span> and its <span>"force-async"</span>
+  flag must be unset. If the parser was originally created for the
+  <span>XML fragment parsing algorithm</span>, then the element must
+  be marked as <span>"already started"</span> also. When the element's
+  end tag is parsed, the user agent must <span title="running a
+  script">run</span> the <code>script</code> element. If this causes
+  there to be a <span>pending parsing-blocking script</span>, then the
+  user agent must run the following steps:</p>
 
   <ol>
 




More information about the Commit-Watchers mailing list