[html5] r3456 - [gi] (2) Define how innerHTML triggers <script defer> scripts. This is pretty ri [...]
whatwg at whatwg.org
whatwg at whatwg.org
Mon Jul 20 18:39:48 PDT 2009
Author: ianh
Date: 2009-07-20 18:39:47 -0700 (Mon, 20 Jul 2009)
New Revision: 3456
Modified:
index
source
Log:
[gi] (2) Define how innerHTML triggers <script defer> scripts. This is pretty ridiculous.
Modified: index
===================================================================
--- index 2009-07-20 23:00:00 UTC (rev 3455)
+++ index 2009-07-21 01:39:47 UTC (rev 3456)
@@ -67,7 +67,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
- <h2 class="no-num no-toc" id=draft-standard-—-date:-01-jan-1901>Draft Standard — 20 July 2009</h2>
+ <h2 class="no-num no-toc" id=draft-standard-—-date:-01-jan-1901>Draft Standard — 21 July 2009</h2>
<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>-->
@@ -9359,6 +9359,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>
@@ -11423,6 +11463,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>
@@ -11514,8 +11556,13 @@
</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>
Modified: source
===================================================================
--- source 2009-07-20 23:00:00 UTC (rev 3455)
+++ source 2009-07-21 01:39:47 UTC (rev 3456)
@@ -9664,6 +9664,53 @@
<li>
+ <p>If the node is an <code>Element</code> node, and the node's
+ document is an <span title="HTML documents">HTML document</span>,
+ and the node is <span>in a <code>Document</code></span>, and the
+ node's document has an <span>active parser</span>, and the
+ <span>insertion point</span> associated with that parser's
+ <span>input stream</span> is not undefined (that is, it
+ <em>does</em> point to somewhere in the input stream), and the
+ <span>list of scripts that will execute when the document has
+ finished parsing</span> is not empty, then run the following
+ substeps:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">the script</var> be the first element in
+ the <span>list of scripts that will execute when the document has
+ finished parsing</span>.</p></li>
+
+ <li><p><span>Pause</span> until <var title="">the script</var>
+ has <span>completed loading</span>.</p></li>
+
+ <li><p><span title="executing a script block">Execute</span> <var
+ title="">the script</var>.</p></li>
+
+ <li><p>Remove <var title="">the script</var> from the <span>list
+ of scripts that will execute when the document has finished
+ parsing</span> (i.e. shift out the first entry in the
+ list).</p></li>
+
+ <li><p>If there are any more entries in the <span>list of scripts
+ that will execute when the document has finished parsing</span>
+ then jump back to step 1.</p></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 <span title="HTML documents">HTML
document</span>: Invoke the <span>HTML fragment parsing
algorithm</span>.</p>
@@ -12051,6 +12098,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>
@@ -12158,6 +12207,12 @@
</ol>
+ <p class="note">The scripts in the <span>list of scripts that will
+ execute when the document has finished parsing</span> can also get
+ executed prematurely if the <code
+ title="dom-innerHTML">innerHTML</code> attribute is set on a node
+ in the document.</p>
+
</dd>
<dt>If the <code>script</code> element was added to the <dfn>list
More information about the Commit-Watchers
mailing list