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 14:26:02 +0100
Message-ID: <43A957EA.3080201@vip.cybercity.dk>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: www-style <www-style@w3.org>

Lachlan Hunt wrote:
> The second which I gather from this description is like putting a 
> condition which must evaluate to true before the actual selector will be 
> matched.
> i.e.
>   selector1 / selector2 { ... }
> is equivalent to this pseudo-code algorithm.
> IF selector1 matches anything
>    find matches for selector2 and apply styles
> This concept seems somewhat like the previously proposed :matches() 
> pseudo-class (there's plenty of discussion about it in the archives), 
> but it too has significant problems and we're unlikely to see it any 
> time soon, if at all.  If I understand correctly, the above example 
> would be equivalent to
>   selector2:matches(selector1) { ... }
I see your point, even though I do not think this idea is equal to the 
:matches() proposal (at least not in the way I read 
http://www.hixie.ch/specs/css/selectors/ProposedChanges.txt which I got 
from http://lists.w3.org/Archives/Public/www-style/2000Jan/0187.html).

What I'm thinking is going to the root of the document, and search for a 
new selector.

Perhaps a better idea would be to make use of the :root pseudo-class.

Say you've got the following selector:

#foo>#bar :root #foobar { /* Previously #foo>#bar / #foobar */
	background-color: red;

In this example if #bar is in #foo, #foobar will have a red background.
I'm not proposing just to go a few steps up the tree, but all the way to 
the top, and evaluate again. Also, I think it seems way easier to go to 
root, rather than going backwards.(?)

Jesper Hermansen
Received on Wednesday, 21 December 2005 13:26:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:22 UTC