hixie: Make DOMContentLoaded wait until after scripts have run. (whatwg r3457)

hixie: Make DOMContentLoaded wait until after scripts have run. (whatwg
r3457)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2581&r2=1.2582&f=h
http://html5.org/tools/web-apps-tracker?from=3456&to=3457

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2581
retrieving revision 1.2582
diff -u -d -r1.2581 -r1.2582
--- Overview.html 21 Jul 2009 01:39:53 -0000 1.2581
+++ Overview.html 21 Jul 2009 02:25:11 -0000 1.2582
@@ -58742,12 +58742,20 @@
   the document, the user agent must follow the steps in this
   section.</p>
 
-  <p>First, the <a href="#current-document-readiness">current document readiness</a> must be set to
-  "interactive".</p>
+  <!-- this happens as part of one of the tasks that runs the parser -->
 
-  <p>Then, the rules for <a href="#when-a-script-completes-loading">when a script completes loading</a>
-  start applying (script execution is no longer managed by the
-  parser).</p>
+  <p>First, the user agent must set the <a href="#current-document-readiness">current document
+  readiness</a> to "interactive".</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>, the <a href="#list-of-scripts-that-will-execute-asynchronously">list of scripts that
+  will execute asynchronously</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>
+
+  <p>The rules for <a href="#when-a-script-completes-loading">when a script completes loading</a> start
+  applying (script execution is no longer managed by the parser).</p>
 
   <p>If any of the scripts in the <a href="#list-of-scripts-that-will-execute-as-soon-as-possible">list of scripts that will
   execute as soon as possible</a> have <a href="#completed-loading">completed
@@ -58757,19 +58765,23 @@
   if those scripts just completed loading, following the rules given
   for that in the <code><a href="#script">script</a></code> element definition.</p>
 
-  <p>Then, 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>
+  <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>
 
-  <p>By this point, there will be no scripts that have loaded but have
-  not yet been executed.</p>
+  <p class="note">By this point, there will be no scripts that have
+  loaded but have not yet been executed.</p>
 
-  <p>The user agent must then <a href="#fire-a-simple-event">fire a simple event</a> called
-  <code title="event-DOMContentLoaded">DOMContentLoaded</code> at the
-  <code>Document</code>.</p>
+  <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> called <code title="event-DOMContentLoaded">DOMContentLoaded</code> at the
+  <code>Document</code>. (If the list is empty, this happens
+  immediately.)</p>
 
-  <p>Once everything that <dfn id="delay-the-load-event" title="delay the load event">delays the
+  <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>

Received on Tuesday, 21 July 2009 02:26:12 UTC