[html5] r6677 - [e] (0) Clarify the outline algorithm to indicate that it only applies to sectio [...]

whatwg at whatwg.org whatwg at whatwg.org
Wed Oct 12 15:41:51 PDT 2011


Author: ianh
Date: 2011-10-12 15:41:49 -0700 (Wed, 12 Oct 2011)
New Revision: 6677

Modified:
   complete.html
   index
   source
Log:
[e] (0) Clarify the outline algorithm to indicate that it only applies to sectioning content and sectioning root elements.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13880

Modified: complete.html
===================================================================
--- complete.html	2011-10-12 19:46:31 UTC (rev 6676)
+++ complete.html	2011-10-12 22:41:49 UTC (rev 6677)
@@ -17989,9 +17989,11 @@
 
    <li>
 
-    <p>As you walk over the DOM in <a href=#tree-order>tree order</a>, trigger
-    the first relevant step below for each element as you enter and
-    exit it.</p>
+    <p>As you walk over the DOM in <a href=#tree-order>tree order</a>, starting
+    with the <a href=#sectioning-content>sectioning content</a> element or
+    <a href=#sectioning-root>sectioning root</a> element at the root of the subtree
+    for which an outline is to be created, trigger the first relevant
+    step below for each element as you enter and exit it.</p>
 
     <dl class=switch><dt>If you are exiting an element and that element is the element
      at the top of the stack</dt>
@@ -18088,8 +18090,11 @@
 
      <dd>
 
-      <p class=note>The <var title="">current outlinee</var> is
-      the element being exited.</p>
+      <p class=note>The <var title="">current outlinee</var> is the
+      element being exited, and it is the <a href=#sectioning-content>sectioning
+      content</a> element or a <a href=#sectioning-root>sectioning root</a> element
+      at the root of the subtree for which an outline is being
+      generated.</p>
 
       <p>Let <var title="">current section</var> be the first <a href=#concept-section title=concept-section>section</a> in the
       <a href=#outline>outline</a> of the <var title="">current outlinee</var>
@@ -18101,11 +18106,6 @@
      </dd>
 
 
-     <dt>If the <var title="">current outlinee</var> is null</dt>
-
-     <dd><p>Do nothing.</dd>
-
-
      <dt>When entering a <a href=#heading-content>heading content</a> element</dt>
 
      <dd>
@@ -18155,29 +18155,22 @@
 
     </dl><p id=associatedSection>In addition, whenever you exit a node,
     after doing the steps above, if the node is not associated with a
-    <a href=#concept-section title=concept-section>section</a> yet and <var title="">current section</var> is not null, associate the node
-    with the <a href=#concept-section title=concept-section>section</a> <var title="">current section</var>.</p>
+    <a href=#concept-section title=concept-section>section</a> yet, associate the
+    node with the <a href=#concept-section title=concept-section>section</a> <var title="">current section</var>.</p>
 
    </li>
 
-   <li><p>If the <var title="">current outlinee</var> is null,
-   then there was no <a href=#sectioning-content>sectioning content</a> element or
-   <a href=#sectioning-root>sectioning root</a> element in the DOM. There is no
-   <a href=#outline>outline</a>. Abort these steps.</li>
-
-   <li><p>Associate any nodes that were not associated with a <a href=#concept-section title=concept-section>section</a> in the steps above with <var title="">current outlinee</var> as their section.</li>
-
    <li><p>Associate all nodes with the heading of the <a href=#concept-section title=concept-section>section</a> with which they are
    associated, if any.</li>
 
-   <li><p>If <var title="">current outlinee</var> is <a href=#the-body-element-0>the body
-   element</a>, then the outline created for that element is the
-   <a href=#outline>outline</a> of the entire document.</li>
-
   </ol><p>The tree of sections created by the algorithm above, or a proper
   subset thereof, must be used when generating document outlines, for
   example when generating tables of contents.</p>
 
+  <p>The outline created for <a href=#the-body-element-0>the body element</a> of a
+  <code><a href=#document>Document</a></code> is the <a href=#outline>outline</a> of the entire
+  document.</p>
+
   <p>When creating an interactive table of contents, entries should
   jump the user to the relevant <a href=#sectioning-content>sectioning content</a>
   element, if the <a href=#concept-section title=concept-section>section</a> was
@@ -18237,8 +18230,10 @@
 
    <p>The following JavaScript function shows how the tree walk could
    be implemented. The <var title="">root</var> argument is the root
-   of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
-   the nodes as they are entered and exited. <a href=#refsECMA262>[ECMA262]</a></p>
+   of the tree to walk (either a <a href=#sectioning-content>sectioning content</a>
+   element or a <a href=#sectioning-root>sectioning root</a> element), and the <var title="">enter</var> and <var title="">exit</var> arguments are
+   callbacks that are called with the nodes as they are entered and
+   exited. <a href=#refsECMA262>[ECMA262]</a></p>
 
    <pre>function (root, enter, exit) {
   var node = root;
@@ -18250,14 +18245,14 @@
     }
     while (node) {
       exit(node);
-      if (node.nextSibling) {
+      if (node == root) {
+        node = null;
+      } else if (node.nextSibling) {
         node = node.nextSibling;
         continue start;
-      }
-      if (node == root)
-        node = null;
-      else
+      } else {
         node = node.parentNode;
+      }
     }
   }
 }</pre>

Modified: index
===================================================================
--- index	2011-10-12 19:46:31 UTC (rev 6676)
+++ index	2011-10-12 22:41:49 UTC (rev 6677)
@@ -17989,9 +17989,11 @@
 
    <li>
 
-    <p>As you walk over the DOM in <a href=#tree-order>tree order</a>, trigger
-    the first relevant step below for each element as you enter and
-    exit it.</p>
+    <p>As you walk over the DOM in <a href=#tree-order>tree order</a>, starting
+    with the <a href=#sectioning-content>sectioning content</a> element or
+    <a href=#sectioning-root>sectioning root</a> element at the root of the subtree
+    for which an outline is to be created, trigger the first relevant
+    step below for each element as you enter and exit it.</p>
 
     <dl class=switch><dt>If you are exiting an element and that element is the element
      at the top of the stack</dt>
@@ -18088,8 +18090,11 @@
 
      <dd>
 
-      <p class=note>The <var title="">current outlinee</var> is
-      the element being exited.</p>
+      <p class=note>The <var title="">current outlinee</var> is the
+      element being exited, and it is the <a href=#sectioning-content>sectioning
+      content</a> element or a <a href=#sectioning-root>sectioning root</a> element
+      at the root of the subtree for which an outline is being
+      generated.</p>
 
       <p>Let <var title="">current section</var> be the first <a href=#concept-section title=concept-section>section</a> in the
       <a href=#outline>outline</a> of the <var title="">current outlinee</var>
@@ -18101,11 +18106,6 @@
      </dd>
 
 
-     <dt>If the <var title="">current outlinee</var> is null</dt>
-
-     <dd><p>Do nothing.</dd>
-
-
      <dt>When entering a <a href=#heading-content>heading content</a> element</dt>
 
      <dd>
@@ -18155,29 +18155,22 @@
 
     </dl><p id=associatedSection>In addition, whenever you exit a node,
     after doing the steps above, if the node is not associated with a
-    <a href=#concept-section title=concept-section>section</a> yet and <var title="">current section</var> is not null, associate the node
-    with the <a href=#concept-section title=concept-section>section</a> <var title="">current section</var>.</p>
+    <a href=#concept-section title=concept-section>section</a> yet, associate the
+    node with the <a href=#concept-section title=concept-section>section</a> <var title="">current section</var>.</p>
 
    </li>
 
-   <li><p>If the <var title="">current outlinee</var> is null,
-   then there was no <a href=#sectioning-content>sectioning content</a> element or
-   <a href=#sectioning-root>sectioning root</a> element in the DOM. There is no
-   <a href=#outline>outline</a>. Abort these steps.</li>
-
-   <li><p>Associate any nodes that were not associated with a <a href=#concept-section title=concept-section>section</a> in the steps above with <var title="">current outlinee</var> as their section.</li>
-
    <li><p>Associate all nodes with the heading of the <a href=#concept-section title=concept-section>section</a> with which they are
    associated, if any.</li>
 
-   <li><p>If <var title="">current outlinee</var> is <a href=#the-body-element-0>the body
-   element</a>, then the outline created for that element is the
-   <a href=#outline>outline</a> of the entire document.</li>
-
   </ol><p>The tree of sections created by the algorithm above, or a proper
   subset thereof, must be used when generating document outlines, for
   example when generating tables of contents.</p>
 
+  <p>The outline created for <a href=#the-body-element-0>the body element</a> of a
+  <code><a href=#document>Document</a></code> is the <a href=#outline>outline</a> of the entire
+  document.</p>
+
   <p>When creating an interactive table of contents, entries should
   jump the user to the relevant <a href=#sectioning-content>sectioning content</a>
   element, if the <a href=#concept-section title=concept-section>section</a> was
@@ -18237,8 +18230,10 @@
 
    <p>The following JavaScript function shows how the tree walk could
    be implemented. The <var title="">root</var> argument is the root
-   of the tree to walk, and the <var title="">enter</var> and <var title="">exit</var> arguments are callbacks that are called with
-   the nodes as they are entered and exited. <a href=#refsECMA262>[ECMA262]</a></p>
+   of the tree to walk (either a <a href=#sectioning-content>sectioning content</a>
+   element or a <a href=#sectioning-root>sectioning root</a> element), and the <var title="">enter</var> and <var title="">exit</var> arguments are
+   callbacks that are called with the nodes as they are entered and
+   exited. <a href=#refsECMA262>[ECMA262]</a></p>
 
    <pre>function (root, enter, exit) {
   var node = root;
@@ -18250,14 +18245,14 @@
     }
     while (node) {
       exit(node);
-      if (node.nextSibling) {
+      if (node == root) {
+        node = null;
+      } else if (node.nextSibling) {
         node = node.nextSibling;
         continue start;
-      }
-      if (node == root)
-        node = null;
-      else
+      } else {
         node = node.parentNode;
+      }
     }
   }
 }</pre>

Modified: source
===================================================================
--- source	2011-10-12 19:46:31 UTC (rev 6676)
+++ source	2011-10-12 22:41:49 UTC (rev 6677)
@@ -19148,9 +19148,11 @@
 
    <li>
 
-    <p>As you walk over the DOM in <span>tree order</span>, trigger
-    the first relevant step below for each element as you enter and
-    exit it.</p>
+    <p>As you walk over the DOM in <span>tree order</span>, starting
+    with the <span>sectioning content</span> element or
+    <span>sectioning root</span> element at the root of the subtree
+    for which an outline is to be created, trigger the first relevant
+    step below for each element as you enter and exit it.</p>
 
     <dl class="switch">
 
@@ -19261,8 +19263,11 @@
 
      <dd>
 
-      <p class="note">The <var title="">current outlinee</var> is
-      the element being exited.</p>
+      <p class="note">The <var title="">current outlinee</var> is the
+      element being exited, and it is the <span>sectioning
+      content</span> element or a <span>sectioning root</span> element
+      at the root of the subtree for which an outline is being
+      generated.</p>
 
       <p>Let <var title="">current section</var> be the first <span
       title="concept-section">section</span> in the
@@ -19275,11 +19280,6 @@
      </dd>
 
 
-     <dt>If the <var title="">current outlinee</var> is null</dt>
-
-     <dd><p>Do nothing.</p></dd>
-
-
      <dt>When entering a <span>heading content</span> element</dt>
 
      <dd>
@@ -19346,36 +19346,26 @@
 
     <p id="associatedSection">In addition, whenever you exit a node,
     after doing the steps above, if the node is not associated with a
-    <span title="concept-section">section</span> yet and <var
-    title="">current section</var> is not null, associate the node
-    with the <span title="concept-section">section</span> <var
+    <span title="concept-section">section</span> yet, associate the
+    node with the <span title="concept-section">section</span> <var
     title="">current section</var>.</p>
 
    </li>
 
-   <li><p>If the <var title="">current outlinee</var> is null,
-   then there was no <span>sectioning content</span> element or
-   <span>sectioning root</span> element in the DOM. There is no
-   <span>outline</span>. Abort these steps.</p></li>
-
-   <li><p>Associate any nodes that were not associated with a <span
-   title="concept-section">section</span> in the steps above with <var
-   title="">current outlinee</var> as their section.</p></li>
-
    <li><p>Associate all nodes with the heading of the <span
    title="concept-section">section</span> with which they are
    associated, if any.</p></li>
 
-   <li><p>If <var title="">current outlinee</var> is <span>the body
-   element</span>, then the outline created for that element is the
-   <span>outline</span> of the entire document.</p></li>
-
   </ol>
 
   <p>The tree of sections created by the algorithm above, or a proper
   subset thereof, must be used when generating document outlines, for
   example when generating tables of contents.</p>
 
+  <p>The outline created for <span>the body element</span> of a
+  <code>Document</code> is the <span>outline</span> of the entire
+  document.</p>
+
   <p>When creating an interactive table of contents, entries should
   jump the user to the relevant <span>sectioning content</span>
   element, if the <span title="concept-section">section</span> was
@@ -19443,10 +19433,11 @@
 
    <p>The following JavaScript function shows how the tree walk could
    be implemented. The <var title="">root</var> argument is the root
-   of the tree to walk, and the <var title="">enter</var> and <var
-   title="">exit</var> arguments are callbacks that are called with
-   the nodes as they are entered and exited. <a
-   href="#refsECMA262">[ECMA262]</a></p>
+   of the tree to walk (either a <span>sectioning content</span>
+   element or a <span>sectioning root</span> element), and the <var
+   title="">enter</var> and <var title="">exit</var> arguments are
+   callbacks that are called with the nodes as they are entered and
+   exited. <a href="#refsECMA262">[ECMA262]</a></p>
 
    <pre>function (root, enter, exit) {
   var node = root;
@@ -19458,14 +19449,14 @@
     }
     while (node) {
       exit(node);
-      if (node.nextSibling) {
+      if (node == root) {
+        node = null;
+      } else if (node.nextSibling) {
         node = node.nextSibling;
         continue start;
-      }
-      if (node == root)
-        node = null;
-      else
+      } else {
         node = node.parentNode;
+      }
     }
   }
 }</pre>




More information about the Commit-Watchers mailing list