Re: [selectors] :sorted pseudoclass for sorted tables

On Nov 25, 2013, at 1:05 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> Now that HTML defines a way to sort tables, Hixie would like a
> pseudoclass letting authors target based on this:
> <https://www.w3.org/Bugs/Public/show_bug.cgi?id=20522>
> 
> His proposal is for a :sorted pseudo-class, which also comes in a
> functional version, :sorted( [ ascending | descending ] ).  He's
> looking at defining it to match <th> elements that head a sorted
> column.
> 
> Thoughts?  Any objections to me adding this to Selectors 4?

Sounds reasonable. If we’re going to add it though, I suggest we also add the capability to select on the ordinality of the sort, something like:
:sorted( [ ascending | descending ] || <number> )

It’s also unfortunate that the selector uses ‘ascending’ and ‘descending’ where HTML uses ‘’ and ‘reversed’ for the sort order. It would be easier for authors to remember if they were in sync.

Peter

Received on Tuesday, 26 November 2013 04:07:05 UTC