[html5] r2947 - [cgiowt] (2) Instead of cloning elements in the DOM, use the original tokens to [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Mar 31 17:41:40 PDT 2009


Author: ianh
Date: 2009-03-31 17:41:39 -0700 (Tue, 31 Mar 2009)
New Revision: 2947

Modified:
   index
   source
Log:
[cgiowt] (2) Instead of cloning elements in the DOM, use the original tokens to reconstruct elements. (credit: hs) (bug 6743)

Modified: index
===================================================================
--- index	2009-04-01 00:25:26 UTC (rev 2946)
+++ index	2009-04-01 00:41:39 UTC (rev 2947)
@@ -52256,6 +52256,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>
@@ -52289,20 +52294,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=#refsDOM3CORE>[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
@@ -55218,13 +55223,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>
@@ -55251,41 +55257,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

Modified: source
===================================================================
--- source	2009-04-01 00:25:26 UTC (rev 2946)
+++ source	2009-04-01 00:41:39 UTC (rev 2947)
@@ -64172,6 +64172,11 @@
   prevent formatting from "leaking" into <code>applet</code> elements,
   buttons, <code>object</code> elements, marquees, and tables.</p>
 
+  <p>In addition, each element in the <span>list of active formatting
+  elements</span> 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>reconstruct the
   active formatting elements</dfn>, the UA must perform the following
   steps:</p>
@@ -64207,21 +64212,21 @@
    <var title="">entry</var> in the <span>list of active formatting
    elements</span>.</li>
 
-   <li>Perform a shallow clone of the element <var title="">entry</var> to
-   obtain <var title="">clone</var>. <a
-   href="#refsDOM3CORE">[DOM3CORE]</a></li>
+   <li><span>Create an element for the token</span> 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 <span>current
+   <li>Append <var title="">new element</var> to the <span>current
    node</span> and push it onto the <span>stack of open
    elements</span> so that it is the new <span>current
    node</span>.</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 <span>list of
-   active formatting elements</span> 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
+   <span>list of active formatting elements</span> is not the last
+   entry in the list, return to step 7.</li>
 
   </ol>
 
@@ -67483,13 +67488,14 @@
        title="">node</var> in the <span>list of active formatting
        elements</span>.</li>
 
-       <li>Perform a shallow
-       clone of <var title="">node</var>, replace the entry for
-       <var title="">node</var> in the <span>list of active formatting
-       elements</span> with an entry for the clone, replace the
-       entry for <var title="">node</var> in the <span>stack of open
-       elements</span> with an entry for the clone, and let
-       <var title="">node</var> be the clone.</li>
+       <li><span>Create an element for the token</span> for which the
+       element <var title="">node</var> was created, replace the entry
+       for <var title="">node</var> in the <span>list of active
+       formatting elements</span> with an entry for the new element,
+       replace the entry for <var title="">node</var> in the
+       <span>stack of open elements</span> 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
@@ -67519,36 +67525,32 @@
 
      </li>
 
-     <li><p>Perform a shallow clone of the <var title="">formatting
-     element</var>.</p></li>
+     <li><p><span>Create an element for the token</span> for which the
+     <var title="">formatting element</var> was created.</p></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.</p></li>
 
-     <li><p>Append that clone to the <var title="">furthest
+     <li><p>Append that new element to the <var title="">furthest
      block</var>.</p></li>
 
      <li><p>Remove the <var title="">formatting element</var> from the
-     <span>list of active formatting elements</span>, and insert
-     the clone into the <span>list of active formatting
+     <span>list of active formatting elements</span>, and insert the
+     new element into the <span>list of active formatting
      elements</span> at the position of the aforementioned
      bookmark.</p></li>
 
      <li><p>Remove the <var title="">formatting element</var> from the
-     <span>stack of open elements</span>, and insert the clone into
-     the <span>stack of open elements</span> immediately below the
-     position of the <var title="">furthest block</var> in that
+     <span>stack of open elements</span>, and insert the new element
+     into the <span>stack of open elements</span> immediately below
+     the position of the <var title="">furthest block</var> in that
      stack.</p></li>
 
      <li><p>Jump back to step 1 in this series of steps.</p></li>
 
     </ol>
 
-    <p class="note">The way these steps are defined, only elements
-    in the <span>formatting</span> category ever get cloned by
-    this algorithm.</p>
-
 <!--XXX
     <div class="example">
      <p class="XXX">Need an example.</p>




More information about the Commit-Watchers mailing list