W3C home > Mailing lists > Public > www-style@w3.org > December 2005

Re: Redo selectors instead of parent-selectors

From: Jesper Hermansen <hermandsen@vip.cybercity.dk>
Date: Wed, 21 Dec 2005 19:16:33 +0100
Message-ID: <43A99C01.4060509@vip.cybercity.dk>
To: Mikko Rantalainen <mikko.rantalainen@peda.net>
CC: www-style@w3.org

Mikko Rantalainen wrote:
> I'd prefer
> 
> #foobar:root-matches(#foo>#bar)
> { /* Previously #foo>#bar / #foobar */
>     background-color: red;
> }
> 
> This pseudo-element would be defined as
> 
> :root-matches(SELECTOR) - matches elements if the SELECTOR would match 
> any element (the SELECTOR is matched against the whole document).
> 
> I've no idea how this could be implemented with high performance.

I don't have an opinion on syntax, since someone else could probably 
come up with something better. I've only suggested what I would like to 
see in the future of CSS-selectors: A possibility to select an element, 
if another selector validates.

Also, I don't know how hard this is to implement, but my guess would be 
that instead of going through one selector, you'd have to go through 
two, perhaps more, depending on the number of validated selectors.

This could be useful, for instance, if you want different backgrounds 
for your document, depending on it's contents. Say black when #foo 
validates, white when #bar validates and orange when neither valitates.

Again, I don't know anything about how to implement this, I just see the 
advantage for this feature, as a web developer.
Though if it's nearly impossible to do, I guess the discussion is finished.

Jesper Hermansen
Received on Wednesday, 21 December 2005 18:17:07 GMT

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