Bugzilla – Bug 86
Change the meaning of <ol> and <ul> subtly; include some examples.
Last modified: 2008-03-05 22:20:30 CET
Index: source =================================================================== --- source (revision 1241) +++ source (revision 1242) @@ -7844,8 +7844,12 @@ </dd> </dl> - <p>The <code>ol</code> element represents an ordered list of items - (which are represented by <code>li</code> elements).</p> + <p>The <code>ol</code> element represents a list of items, where the + items have been intentionally ordered, such that changing the order + would change the meaning of the document.</p> + + <p>The items of the list are the <code>li</code> element child nodes + of the <code>ol</code> element, in <span>tree order</span>.</p> <p>The <dfn title="attr-ol-start"><code>start</code></dfn> attribute, if present, must be a <span>valid integer</span> giving @@ -7858,9 +7862,6 @@ missing or if the value cannot be converted to a number according to the referenced algorithm, is 1.</p> - <p>The items of the list are the <code>li</code> element child nodes - of the <code>ol</code> element, in <span>tree order</span>.</p> - <p>The first item in the list has the ordinal value given by the <code>ol</code> element's <code title="attr-ol-start">start</code> attribute, unless that <code>li</code> element has a <code @@ -7881,6 +7882,39 @@ <!-- XXX counting up and down? --> <!-- XXX reverse-counted lists? --> + <div class="example"> + + <p>The following markup shows a list where the order matters, and + where the <code>ol</code> element is therefore appropriate. Compare + this list to the equivalent list in the <code>ul</code> section to + see an example of the same items using the <code>ul</code> + element.</p> + + <pre><p>I have lived in the following countries (given in the order of when +I first lived there):</p> +<ol> + <li>Switzerland + <li>United Kingdom + <li>United States + <li>Norway +</ol></pre> + + <p>Note how changing the order of the list changes the meaning of + the document. In the following example, changing the relative order + of the first two items has changed the birthplace of the + author:</p> + + <pre><p>I have lived in the following countries (given in the order of when +I first lived there):</p> +<ol> + <li>United Kingdom + <li>Switzerland + <li>United States + <li>Norway +</ol></pre> + + </div> + <h4>The <dfn><code>ul</code></dfn> element</h4> @@ -7900,12 +7934,46 @@ <dd>No difference from <code>HTMLElement</code>.</dd> </dl> - <p>The <code>ul</code> element represents an unordered list of items - (which are represented by <code>li</code> elements).</p> + <p>The <code>ul</code> element represents a list of items, where the + order of the items is not important — that is, where changing + the order would not materially change the meaning of the + document.</p> <p>The items of the list are the <code>li</code> element child nodes of the <code>ul</code> element.</p> + <div class="example"> + + <p>The following markup shows a list where the order does not + matter, and where the <code>ul</code> element is therefore + appropriate. Compare this list to the equivalent list in the + <code>ol</code> section to see an example of the same items using + the <code>ol</code> element.</p> + + <pre><p>I have lived in the following countries:</p> +<ol> + <li>Norway + <li>Switzerland + <li>United Kingdom + <li>United States +</ol></pre> + + <p>Note that changing the order of the list does not change the + meaning of the document. The items in the snippet above are given + in alphabetical order, but in the snippet below they are given in + order of the size of their current account balance in 2007, without + changing the meaning of the document whatsoever:</p> + + <pre><p>I have lived in the following countries:</p> +<ol> + <li>Switzerland + <li>Norway + <li>United Kingdom + <li>United States +</ol></pre> + + </div> + <h4>The <dfn><code>li</code></dfn> element</h4>
*** Bug 71 has been marked as a duplicate of this bug. ***
*** Bug 124 has been marked as a duplicate of this bug. ***
Not machine-checkable.