- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 12 Oct 2011 22:46:30 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv32161 Modified Files: sections.html spec.html Log Message: Clarify the outline algorithm to indicate that it only applies to sectioning content and sectioning root elements. (whatwg r6677) [updated by splitter] Index: spec.html =================================================================== RCS file: /sources/public/html5/spec/spec.html,v retrieving revision 1.1717 retrieving revision 1.1718 diff -u -d -r1.1717 -r1.1718 --- spec.html 12 Oct 2011 20:46:44 -0000 1.1717 +++ spec.html 12 Oct 2011 22:46:27 -0000 1.1718 @@ -349,7 +349,7 @@ <a href="Overview.html">single page HTML</a>, <a href="spec.html">multipage HTML</a>, <a href="author/">web developer edition</a>. -This is revision 1.5354. +This is revision 1.5355. </p> <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><abbr title="World Wide Index: sections.html =================================================================== RCS file: /sources/public/html5/spec/sections.html,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- sections.html 5 Oct 2011 23:46:31 -0000 1.60 +++ sections.html 12 Oct 2011 22:46:27 -0000 1.61 @@ -1514,9 +1514,11 @@ <li> - <p>As you walk over the DOM in <a href="infrastructure.html#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="infrastructure.html#tree-order">tree order</a>, starting + with the <a href="content-models.html#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> @@ -1613,8 +1615,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="content-models.html#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> @@ -1626,11 +1631,6 @@ </dd> - <dt>If the <var title="">current outlinee</var> is null</dt> - - <dd><p>Do nothing.</p></dd> - - <dt>When entering a <a href="content-models.html#heading-content">heading content</a> element</dt> <dd> @@ -1680,29 +1680,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="content-models.html#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.</p></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.</p></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.</p></li> - <li><p>If <var title="">current outlinee</var> is <a href="dom.html#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.</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 <a href="dom.html#the-body-element-0">the body element</a> of a + <code><a href="infrastructure.html#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="content-models.html#sectioning-content">sectioning content</a> element, if the <a href="#concept-section" title="concept-section">section</a> was @@ -1762,8 +1755,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="references.html#refsECMA262">[ECMA262]</a></p> + of the tree to walk (either a <a href="content-models.html#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="references.html#refsECMA262">[ECMA262]</a></p> <pre>function (root, enter, exit) { var node = root; @@ -1775,14 +1770,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>
Received on Wednesday, 12 October 2011 22:46:41 UTC