[whatwg] WhatWG spec addition? (fwd)

Olav Junker Kjær olav at olav.dk
Thu Mar 31 03:46:51 PST 2005


John Burns wrote:
> I believe this list selector should be updated to provide columnar
> data formatting and enable properties that include: Greenbar
> (alternating colors - odd rows/even rows), header row, header column.

Nice idea. Instead of doing this as an extension to the select-element, 
I think we should consider a more general approach to selection. It 
would be nice to make it possible to select one or more rows in a table, 
for example.

This would also be useful in combination with the repetition model. For 
example, instead of having a delete button on every block, we could have 
just one delete button, which deleted the currently selected block.

Since any element may be a repetition block, the ability to be
selectable must also apply to all elements.

It not enough to be able to declare that an element is selectable. We 
have to be able to declare the "scope" of selection, i.e. the collection 
of elements from which only one element at a time can be selected.

In most cases it would be sufficient to declare that all immediate
children of a certain element are selectable. E.g.:

<table>
<tr><th>Name</th><td>Address</td></tr>
<tbody childrenselectable=multiple>
... some rows...
</tbody>
</table>

In this case all tr-elements in the tbody is selectable.
However in the case of a tree widget or optgroup elements it gets more 
complicated, since the selectable elements might be nested or grouped by 
other non-selectable elements. Perhaps it should be possible to declare 
that all descendants of a certain type is selectable.

When an element is turned into a container for selectable items, the DOM
should expose methods for retrieving the current selection (or the list
of current selections) and for selecting and unselecting elements
through script.

Btw. I believe alternating colors for table rows is already supported in 
CSS through the :nth-child pseudo-class.

regards
Olav Junker Kjær



More information about the whatwg mailing list