W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2008

[whatwg] Reverse ordered lists

From: James Graham <jg307@cam.ac.uk>
Date: Wed, 23 Jan 2008 17:28:25 +0000
Message-ID: <47977939.3070508@cam.ac.uk>
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
Received on Wednesday, 23 January 2008 09:28:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:00 UTC