[whatwg] Reverse ordered lists

On Wed, 23 Jan 2008 15:03:42 +0100
Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:

> Simon Pieters wrote:
> >    <ol start="100" reverse>
> > 
> > The lack of start='' would make the numbers update as the list is
> > filled with <li>s. This allows both for simplicitly for short lists
> > and correct incremental rendering for large lists.
> 
> No, the lack of an explicit start attribute would make it start from
> the default value: 1.  It would then count down from there:
> 
>   1. A
>   0. B
> -1. C
> -2. D
> 

Actually, the best route I can see is to not have a start attribute at
all but to rely on the browser to automatically detect the amount of
<li> tags within an
<ol reverse> container and decrement from there. ie:

   <ol reverse>   <-- Start count from here.
      <li>Red</li>
      <li>Orange</li>
      <li>Yellow</li>
      <li>Green</li>
      <li>Blue</li>
   </ol>   <-- Close tag detected, 5 <li> tags counted.

is rendered as starting from 5:

    5. Red
    4. Orange
    ...etc...

and using a "step" value, for example, all the browser would need to do
is multiply the total at the </ol> tag, and decrement that
multiplied total by the "step" amount, making:

   <ol reverse step="5">

render the list as:

  25. Red
  20. Orange
  15. Yellow
  ...etc...

It might mean more work for the browsers, but by experience something
like this isn't too hard to implement.

Received on Wednesday, 23 January 2008 06:23:20 UTC