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

[whatwg] Reverse ordered lists

From: Jerason Banes <jbanes@gmail.com>
Date: Fri, 25 Jan 2008 11:43:22 -0600
Message-ID: <82c3f5040801250943q611ef16fmc794dc744e4e5d6a@mail.gmail.com>
To add to what Christoph is saying, perhaps there's a better way to look at
this problem? A reverse list has both a start and an end, just like any
other list. The key is that it's displayed in the opposite order of a
regular list.

This raises the question, why does the list need to be *serialized* in
reverse order? Given that it's a display attribute, wouldn't it make more
sense to force the UA into rendering the list in reverse? e.g.:

<ol style="order: reverse;">
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
<li>five</li>
</ol>

Which would then render like this:

5. five
4. four
3. three
2. two
1. one

This also solves the partial render problem as the list would partial render
as follows.

Step 1:

1. one

Step 2:

2. two
1. one

Step 3:

3. three
2. two
1. one

Step 4:

4. four
3. three
2. two
1. one

Step 5:

5. five
4. four
3. three
2. two
1. one

Obviously this solution puts a bit more of the onus on the User Agent to
render the list correctly, but I think it's semantically more correct than
trying to encapsulate the display data in the DOM ordering. This also
provides backward compatibility as UAs that don't understand the reverse
attribute will still number the list correctly. (Whereas the previous
solutions would result in the numbering being reversed in older browsers.)

Thanks,
Jerason

On Jan 25, 2008 11:29 AM, Christoph P?per <christoph.paeper at crissov.de>
wrote:

> Simon Pieters:
> > It was pointed out to me that the start='' attribute (and the
> > corresponding DOM attribute) currently defaults to 1. This could,
> > AFAICT, reaonably trivially be changed to make it depend on the
> > direction of the list and the number of <li> children.
>
> Or you would introduce an |end| attribute, because 'start' is not the
> same as 'first'...
>
> I think it has been shown, that the meta attribute |reverse| would
> not work in HTML, it would have to be a "command" attribute, i.e. it
> doesn't describe the ordering of the following list items, but their
> indended display. This would make it presentational and thereby not
> suitable for HTML. It would belong into CSS, but that isn't very good
> at reordering boxes.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080125/1a1232b2/attachment.htm>
Received on Friday, 25 January 2008 09:43:22 UTC

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