- From: poot <cvsmail@w3.org>
- Date: Thu, 2 Apr 2009 13:11:51 +0900 (JST)
- To: public-html-diffs@w3.org
Instead of cloning elements in the DOM, use the original tokens to reconstruct elements. (credit: hs) (bug 6743) (whatwg r2947) http://www.w3.org/Bugs/Public/show_bug.cgi?id=6743 list of active formatting elements http://people.w3.org/mike/diffs/html5/spec/Overview.1.2110.html#list-of-active-formatting-elements An end tag whose tag name is one of: "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u" http://people.w3.org/mike/diffs/html5/spec/Overview.1.2110.html#adoptionAgency reconstruct the active formatting elements http://people.w3.org/mike/diffs/html5/spec/Overview.1.2110.html#reconstruct-the-active-formatting-elements http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2109&r2=1.2110&f=h http://html5.org/tools/web-apps-tracker?from=2946&to=2947 =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.2109 retrieving revision 1.2110 diff -u -d -r1.2109 -r1.2110 --- Overview.html 1 Apr 2009 00:20:58 -0000 1.2109 +++ Overview.html 1 Apr 2009 00:45:16 -0000 1.2110 @@ -46677,6 +46677,11 @@ prevent formatting from "leaking" into <code><a href=#the-applet-element>applet</a></code> elements, buttons, <code><a href=#the-object-element>object</a></code> elements, marquees, and tables.</p> + <p>In addition, each element in the <a href=#list-of-active-formatting-elements>list of active formatting + elements</a> is associated with the token for which it was + created, so that further elements can be created for that token if + necessary.</p> + <p>When the steps below require the UA to <dfn id=reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</dfn>, the UA must perform the following steps:</p> @@ -46710,20 +46715,20 @@ <var title="">entry</var> in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li> - <li>Perform a shallow clone of the element <var title="">entry</var> to - obtain <var title="">clone</var>. <a href=#references>[DOM3CORE]</a></li> + <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the + element <var title="">entry</var> was created, to obtain <var title="">new element</var>.</li> - <li>Append <var title="">clone</var> to the <a href=#current-node>current + <li>Append <var title="">new element</var> to the <a href=#current-node>current node</a> and push it onto the <a href=#stack-of-open-elements>stack of open elements</a> so that it is the new <a href=#current-node>current node</a>.</li> <li>Replace the entry for <var title="">entry</var> in the list - with an entry for <var title="">clone</var>.</li> + with an entry for <var title="">new element</var>.</li> - <li>If the entry for <var title="">clone</var> in the <a href=#list-of-active-formatting-elements>list of - active formatting elements</a> is not the last entry in the - list, return to step 7.</li> + <li>If the entry for <var title="">new element</var> in the + <a href=#list-of-active-formatting-elements>list of active formatting elements</a> is not the last + entry in the list, return to step 7.</li> </ol><p>This has the effect of reopening all the formatting elements that were opened in the current body, cell, or caption (whichever is @@ -49639,13 +49644,14 @@ bookmark to be immediately after the <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting elements</a>.</li> - <li>Perform a shallow - clone of <var title="">node</var>, replace the entry for - <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active formatting - elements</a> with an entry for the clone, replace the - entry for <var title="">node</var> in the <a href=#stack-of-open-elements>stack of open - elements</a> with an entry for the clone, and let - <var title="">node</var> be the clone.</li> + <li><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the + element <var title="">node</var> was created, replace the entry + for <var title="">node</var> in the <a href=#list-of-active-formatting-elements>list of active + formatting elements</a> with an entry for the new element, + replace the entry for <var title="">node</var> in the + <a href=#stack-of-open-elements>stack of open elements</a> with an entry for the new + element, and let <var title="">node</var> be the new + element.</li> <li>Insert <var title="">last node</var> into <var title="">node</var>, first removing it from its previous parent node if any.</li> @@ -49672,41 +49678,35 @@ </li> - <li><p>Perform a shallow clone of the <var title="">formatting - element</var>.</li> + <li><p><a href=#create-an-element-for-the-token>Create an element for the token</a> for which the + <var title="">formatting element</var> was created.</li> <li><p>Take all of the child nodes of the <var title="">furthest - block</var> and append them to the clone created in the last + block</var> and append them to the element created in the last step.</li> - <li><p>Append that clone to the <var title="">furthest + <li><p>Append that new element to the <var title="">furthest block</var>.</li> <li><p>Remove the <var title="">formatting element</var> from the - <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert - the clone into the <a href=#list-of-active-formatting-elements>list of active formatting + <a href=#list-of-active-formatting-elements>list of active formatting elements</a>, and insert the + new element into the <a href=#list-of-active-formatting-elements>list of active formatting elements</a> at the position of the aforementioned bookmark.</li> <li><p>Remove the <var title="">formatting element</var> from the - <a href=#stack-of-open-elements>stack of open elements</a>, and insert the clone into - the <a href=#stack-of-open-elements>stack of open elements</a> immediately below the - position of the <var title="">furthest block</var> in that + <a href=#stack-of-open-elements>stack of open elements</a>, and insert the new element + into the <a href=#stack-of-open-elements>stack of open elements</a> immediately below + the position of the <var title="">furthest block</var> in that stack.</li> <li><p>Jump back to step 1 in this series of steps.</li> - </ol><p class=note>The way these steps are defined, only elements - in the <a href=#formatting>formatting</a> category ever get cloned by - this algorithm.</p> - -<!--XXX + </ol><!--XXX <div class="example"> <p class="XXX">Need an example.</p> </div> ---> - - <p class=note>Because of the way this algorithm causes elements to +--><p class=note>Because of the way this algorithm causes elements to change parents, it has been dubbed the "adoption agency algorithm" (in contrast with other possibly algorithms for dealing with misnested content, which included the "incest algorithm", the
Received on Thursday, 2 April 2009 04:12:28 UTC