hixie: Define how innerHTML triggers <script defer> scripts. This is pretty ridiculous. (whatwg r3456)

hixie: Define how innerHTML triggers <script defer> scripts. This is
pretty ridiculous. (whatwg r3456)

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

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2580
retrieving revision 1.2581
diff -u -d -r1.2580 -r1.2581
--- Overview.html 20 Jul 2009 23:00:08 -0000 1.2580
+++ Overview.html 21 Jul 2009 01:39:53 -0000 1.2581
@@ -175,7 +175,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 23 April 2009</h2>-->
-   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 20 July 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-date-1-january-1970">Editor's Draft 21 July 2009</h2>
    <!--:ZZZ-->
    <dl><!-- ZZZ: update the month/day (twice), (un)comment out
     <dt>This Version:</dt>
@@ -273,7 +273,7 @@
   track.
   <!--ZZZ:-->
   <!--This specification is the 23 April 2009 Working Draft.-->
-  This specification is the 20 July 2009 Editor's Draft.
+  This specification is the 21 July 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)
@@ -8321,6 +8321,46 @@
 
   <ol><li>
 
+    <p>If the node is an <code>Element</code> node, and the node's
+    document is an <a href="#html-documents" title="HTML documents">HTML document</a>,
+    and the node is <a href="#in-a-document">in a <code>Document</code></a>, and the
+    node's document has an <a href="#active-parser">active parser</a>, and the
+    <a href="#insertion-point">insertion point</a> associated with that parser's
+    <a href="#the-input-stream">input stream</a> is not undefined (that is, it
+    <em>does</em> point to somewhere in the input stream), and 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, then run the following
+    substeps:</p>
+
+    <ol><li><p>Let <var title="">the script</var> be the first element 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>
+
+     <li><p><a href="#pause">Pause</a> until <var title="">the script</var>
+     has <a href="#completed-loading">completed loading</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>Remove <var title="">the script</var> 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 there are any more entries 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>
+     then jump back to step 1.</li>
+
+    </ol><!--
+     TESTS: http://www.hixie.ch/tests/adhoc/html/parsing/script-defer-write/
+     Note: IE8 actually drops on the floor any scripts which in step 2
+     of the algorithm above aren't yet completely loaded. I don't want
+     to spec a race condition, though. The alternative to pausing like
+     above, however, is to blow away the doc if the external scripts
+     do document.write(), which apparently might cause issues.
+    --></li>
+
+   <li>
+
     <p>If the node's document is an <a href="#html-documents" title="HTML documents">HTML
     document</a>: Invoke the <a href="#html-fragment-parsing-algorithm">HTML fragment parsing
     algorithm</a>.</p>
@@ -10098,6 +10138,8 @@
        http://www.websiteoptimization.com/speed/tweak/defer/test/
        internal deferred scripts execute before any external scripts execute, or before the LOAD if there are none
        external deferred scripts execute before the LOAD
+     See also the innerHTML attribute, which does weird things for
+     this list of scripts.
      -->
 
      </dd>
@@ -10189,7 +10231,12 @@
 
      </li>
 
-    </ol></dd>
+    </ol><p class="note">The scripts 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> can also get
+    executed prematurely if the <code title="dom-innerHTML"><a href="#dom-innerhtml">innerHTML</a></code> attribute is set on a node
+    in the document.</p>
+
+   </dd>
 
    <dt>If the <code><a href="#script">script</a></code> element was added to the <dfn id="list-of-scripts-that-will-execute-asynchronously">list
    of scripts that will execute asynchronously</dfn>:</dt>

Received on Tuesday, 21 July 2009 01:41:07 UTC