[html5] r2923 - [e] (0) Add example of form association in weird case. (credit: js)
whatwg at whatwg.org
whatwg at whatwg.org
Mon Mar 30 16:53:43 PDT 2009
Author: ianh
Date: 2009-03-30 16:53:42 -0700 (Mon, 30 Mar 2009)
New Revision: 2923
Modified:
index
source
Log:
[e] (0) Add example of form association in weird case. (credit: js)
Modified: index
===================================================================
--- index 2009-03-30 22:56:06 UTC (rev 2922)
+++ index 2009-03-30 23:53:42 UTC (rev 2923)
@@ -33604,8 +33604,39 @@
<li><p>Otherwise, the element is left unassociated.</li>
- </ol></div>
+ </ol><div class=example>
+ <p>In the following non-conforming snippet:</p>
+
+ <pre class=bad>...
+ <form id="a">
+ <div id="b"></div>
+ </form>
+ <script>
+ document.getElementById('b').innerHTML =
+ '<table><tr><td><form id="c"><input id="d"></table>' +
+ '<input id="e">';
+ </script>
+...</pre>
+
+ <p>The <a href=#form-owner>form owner</a> of "d" would be the inner nested
+ form "c", while the <a href=#form-owner>form owner</a> of "e" would be the
+ outer form "a".</p>
+
+ <p>This is because despite the association of "e" with "c" in the
+ <a href=#html-parser>HTML parser</a>, when the <code title=dom-innerHTML><a href=#dom-innerhtml>innerHTML</a></code> algorithm moves the nodes
+ from the temporary document to the "b" element, the nodes see their
+ ancestor chain change, and thus all the "magic" associations done
+ by the parser are reset to normal ancestor associations.</p>
+
+ <p>This example is a non-conforming document, though, as it is a
+ violation of the content models to nest <code><a href=#the-form-element>form</a></code>
+ elements.</p>
+
+ </div>
+
+ </div>
+
<dl class=domintro><dt><var title="">element</var> . <code title=dom-fae-form><a href=#dom-fae-form>form</a></code></dt>
<dd>
Modified: source
===================================================================
--- source 2009-03-30 22:56:06 UTC (rev 2922)
+++ source 2009-03-30 23:53:42 UTC (rev 2923)
@@ -37736,8 +37736,40 @@
</ol>
+ <div class="example">
+
+ <p>In the following non-conforming snippet:</p>
+
+ <pre class="bad">...
+ <form id="a">
+ <div id="b"></div>
+ </form>
+ <script>
+ document.getElementById('b').innerHTML =
+ '<table><tr><td><form id="c"><input id="d"></table>' +
+ '<input id="e">';
+ </script>
+...</pre>
+
+ <p>The <span>form owner</span> of "d" would be the inner nested
+ form "c", while the <span>form owner</span> of "e" would be the
+ outer form "a".</p>
+
+ <p>This is because despite the association of "e" with "c" in the
+ <span>HTML parser</span>, when the <code
+ title="dom-innerHTML">innerHTML</code> algorithm moves the nodes
+ from the temporary document to the "b" element, the nodes see their
+ ancestor chain change, and thus all the "magic" associations done
+ by the parser are reset to normal ancestor associations.</p>
+
+ <p>This example is a non-conforming document, though, as it is a
+ violation of the content models to nest <code>form</code>
+ elements.</p>
+
</div>
+ </div>
+
<dl class="domintro">
<dt><var title="">element</var> . <code title="dom-fae-form">form</code></dt>
More information about the Commit-Watchers
mailing list