[whatwg] Reverse ordered lists
Jerason Banes
jbanes at gmail.com
Fri Jan 25 09:43:22 PST 2008
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-0001.htm>
More information about the whatwg
mailing list