W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: pseudo-attributes

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 16 Oct 2008 17:50:50 -0700
Message-ID: <48F7E16A.7070507@terrainformatica.com>
To: Anne van Kesteren <annevk@opera.com>
CC: "L. David Baron" <dbaron@dbaron.org>, www-style@w3.org

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 04:13:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:15 GMT