Re: Collapsing elements

On Feb 21, 2008, at 10:31 AM, Bert Bos wrote:

>> 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.
>
> My intuition says that overloading ':checked' is dangerous and not  
> very
> intuitive. In the examples I gave so far there is nothing that I would
> associate with putting a check mark. It's collapsed, expanded,  
> toggled,
> set to an alternative state, set to a second state, maybe changed or
> restored, but not checked...

I see checking an element as meaning you are marking it in some way  
to indicate a second state for it, but not necessarily a visual mark.  
The "checked" attribute on an HTML checkbox or radio button means  
that it has been given this second state, instead of the default  
state that everything else has. It doesn't look like a check mark in  
most OS's radio buttons, and even if I make the checkbox invisible,  
its label can still change it to or from this second state.

So, to me, "checked" is perfect, because it allows you to have the  
regular styling in one rule, and the styling for a second binary  
state in another, regardless of how it got marked to achieve that  
second state. With checkbox and radio button buttons, that state can  
be set initially with an element attribute (checked). With a  
collapsing UL it could presumably be thus marked as having that  
second non-default state with JavaScript. But consider if an actual  
functional collapsable UL was added to HTML, with something like <UL  
type="tree">. In that case, its initial state would not necessarily  
be open or closed, collapsed or expanded, but could be set with  
another attribute, like checked:  <UL type="tree" checked>. It seems  
to me that you would need an attribute like checked as part of the  
DOM, so that it could be set via JavaScript or non-scripted HTML, and  
so a click could change that state.

Received on Friday, 22 February 2008 18:15:54 UTC