Re: pseudo-attributes

Anne van Kesteren wrote:
> On Thu, 16 Oct 2008 21:34:24 +0200, Andrew Fedoniouk 
> <news@terrainformatica.com> wrote:
>> selector input#search[:value=""] implies that UA will be forced to 
>> resolve the style of the element on each character typed in the input 
>> element.
>>
>> That I think would be too much.
>
> We already have that "problem" for :valid and :invalid and those work 
> fine (in Opera at least) so I don't think that should be much of an 
> issue.
>
>
:valid and :invalid have almost the same changing frequency as :empty 
so, indeed, that is not a big deal.

Things like:

textarea[:value*="foo"] { border:1px solid red; }
textarea[:value*="foo"] + span.bar { display:none; }

are different in this respect - you have to run style resolution for the 
textarea on each character entered and through the whole style collection.

I think that these kind of things belong more to behaviors/scripting 
rather than to CSS.
Behavior(code) can handle such things better (read more efficiently) and 
change the state of the element for the CSS, e.g.
to add/remove @has-foo attribute for the element.

So in CSS you will write:

textarea[has-foo] + span.bar { display:none; }

and it will not load CSS style processor more than it is loaded now.

--
Andrew Fedoniouk.

http://terrainformatica.com

Received on Friday, 17 October 2008 03:53:21 UTC