- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 30 Mar 2009 23:53:49 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv19329 Modified Files: Overview.html Log Message: Add example of form association in weird case. (credit: js) (whatwg r2923) Index: Overview.html =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.2087 retrieving revision 1.2088 diff -u -d -r1.2087 -r1.2088 --- Overview.html 30 Mar 2009 22:56:11 -0000 1.2087 +++ Overview.html 30 Mar 2009 23:53:46 -0000 1.2088 @@ -29767,7 +29767,38 @@ <li><p>Otherwise, the element is left unassociated.</li> - </ol></div><dl class=domintro><dt><var title="">element</var> . <code title=dom-fae-form><a href=#dom-fae-form>form</a></code></dt> + </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>
Received on Monday, 30 March 2009 23:53:58 UTC