Re: Dual-mode elements (ACTION-37)

On Apr 8, 2008, at 2:10 AM, Bert Bos wrote:

>
> Brad Kemper wrote:
>> Thanks for getting this started, Bert.
>> On Apr 7, 2008, at 10:22 AM, Bert Bos wrote:
>>> Also, there is no property to specify whether an element starts out
>>> collapsed or expanded: it always starts out as ':normal' and the  
>>> style
>> I don't care for that part much. I think it is important to allow  
>> some elements to be in one state and others in another at the  
>> outset, without having to give them different classes. Like you can  
>> with "checked" on radio buttons and checkboxes.
>
> If you can distinguish the elements with selectors, you can also  
> give them different styles. No need to use the class attribute if  
> you don't want to. E.g., you could use the title attribute:
>
>    <li title="make me green">This starts as red.
>    <li title="make me red">This starts as green.
>    <li title="make me red">This, too.
>
>    /* LIs that start red */
>    li[title="make me green"]:normal {color: red}
>    li[title="make me green"]:alternative {color: green}
>
>    /* LIs that start green */
>    li[title="make me red"]:normal {color: green}
>    li[title="make me red"]:alternative {color: red}

That's true, but substituting an attribute selector for a class  
selector doesn't really make me happier about this. I still have to  
have circumlocution in the HTML to tell it that it should be in the  
"alternative" state, and I still have to write twice as many selectors  
(and longer selectors) for it than I would prefer. It would be much  
simpler and straightforward authoring to do the following (attributes  
and values derived from your CSS terminology):

    <li>This starts as red.
    <li target="alternative">This starts as green.
    <li target="alternative">This, too.

    /* LIs that start red */
    li:normal {color: red}
    li:alternative {color: green}

That's also easier to read and make sense of by a human in cases where  
it has to be combined with other complexities that might be required  
for selecting particular elements. I've had to write some pretty long  
selectors and groups of selectors before, so I am in favor of shorter  
forms.

Is the reason for NOT doing something like the above that it would  
require some coordination with another working group?

By the way, it might be nitpicking at this early stage, but I would  
prefer terms that could not be confused with similar sounding html  
attributes, like "target" and "alt". I mentioned "target" before, but  
alternative/alt is similarly less than ideal.


>
>
>
>
> Bert
> -- 
>  Bert Bos                                ( W 3 C ) http://www.w3.org/
>  http://www.w3.org/people/bos                               W3C/ERCIM
>  bert@w3.org                             2004 Rt des Lucioles / BP 93
>  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
>

Received on Tuesday, 8 April 2008 15:40:02 UTC