[whatwg] Reverse ordered lists

James Graham jg307 at cam.ac.uk
Wed Jan 23 09:28:25 PST 2008

Siemova wrote:
> On Jan 23, 2008 10:54 AM, David Walbert <dwalbert at learnnc.org 
> <mailto:dwalbert at learnnc.org>> wrote:
>     It's not that simple -- the last line should be
>     start = 1 + ( (number of items - 1) * step)
>     if it's assumed that the last item of the list is numbered one by
>     default. 
> Alas, we see the ill effects of my hastiness today! I stand happily 
> corrected. In that case, it's even simpler:
> if start is not specified
> start = 1
> if reverse
> start += (number of items - 1) * step

The problem that Jonas originally pointed out is that, given browsers do 
incremental rendering "number of items" is not a known quantity when the list is 
first rendered. For a pathological example of why this is a problem, imagine a 
cgi script that just kept spewing out reverse numbered list items, one per 
second, indefinitely.

It may be that in practice lists are short enough that they are typically 
rendered all in one go so this wouldn't be a problem. I don't think that's 
obvious, however.

"Eternity's a terrible thought. I mean, where's it all going to end?"
  -- Tom Stoppard, Rosencrantz and Guildenstern are Dead

More information about the whatwg mailing list