Re: Redo selectors instead of parent-selectors

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 UTC