Re: Collapsing elements

On Feb 21, 2008, at 7:07 AM, Bert Bos wrote:

>> We need to be able to query 'something' directly from the LI.
>> That means a solution based uniquely on the display property
>> of the children is not enough. We need an attribute on the LI
>> or a unique CSS property setting the expanded/folded status
>> of the item.
>
> A pseudo-class represents a state. According to CSS, elements can be
> active, visited, link, first-child, disabled, target, invalid, etc.  
> I'm
> adding one more: initial.
>
> How do you currently query CSS states from Javascript? Can't you
> generalize (one of) the existing methods to include ':initial' as  
> well?
>
> And there is actually nothing special about the LI. In my example  
> the LI
> *doesn't* have an ':initial' state. There may be any number of  
> elements
> whose states influence the style of the LI, because of cascading or
> inheritance.

The word "initial" sounds like it is only something that exists at  
the beginning, and once someone starts collapsing or expanding it, it  
is no longer initial. Does "initial" represent an open branch of the  
tree or a closed one? It would depend on the style sheet, I guess,  
but that makes its meaning vague. I would prefer something that more  
definitively indicated its actual current state ("opened" or  
"closed"), the way "checked" does for checkboxes and radio buttons.  
But rather than invent a new state and pseudo-class, I would rather  
see "checked' repurposed for this type of list, and given a  
definition to mean open if checked and closed if unchecked.

The author could always simulate reverse behavior if they wanted to,  
I suppose, but the default style sheet could just make "checked" tree  
LI's opened, and "unchecked" LI's closed.

Received on Thursday, 21 February 2008 15:48:20 UTC