RE: [css-selectors] Proposal: Logical Combinators / Sets

If I'm not mistaken, here is the kind of selectors Brian's proposal is aimed to :

    :not(#a) {
        selects all elements that are not #a
    :and(#a *, #b *) {
        selects all elements that have both a #a and a #b parent
    :or(#a, #b) {
        selects all elements that are either #a or #b

The other proposals (like anyOf, oneOf...) can be emulated using those three. Currently, we already have ':not()' (but I think it's somewhat limited to simple selectors) and it's already possible to emulate ':or()' using commas. So "a :or(b,c) d" == "a b d, a c d". So what's really missing is the ':and' operator.

(Brian if I'm wrong please correct me)

> Date: Wed, 13 Mar 2013 14:36:33 -0400 
> From: 
> To: 
> CC:; 
> Subject: Re: [css-selectors] Proposal: Logical Combinators / Sets 
> On Wed, Mar 13, 2013 at 2:25 PM, Liam R E Quin 
> <<>> wrote: 
> On Wed, 2013-03-13 at 12:20 -0400, Brian Kardell wrote: 
> [...] 
> > .person:allOf( [occupation='designers'] *, [country='US'] *).unemployed{ 
> > .... } 
> Your example shows that it's going to be easy to simulate look-ahead, 
> which stalls progressive rendering. People do that today anyway, using 
> jQuery or other libraries, but providing the common cases in forms that 
> are easily optimized seems to be a win, so I think some more work would 
> be needed here. 
> I'm not sure why - I think perhaps you've misunderstand my proposal. 
> In my example the splats represent person, a better way to illustrate 
> it might have been: 
> *:allOf( [occupation='designers'] *, [country='US'] *).person.unemployed 
> Selects descendants of elements that meet both of those criteria, 
> regardless of where (this also makes them more resilient to minor 
> changes in the structure). Since parsing is recursive, it seems 
> impossible that you could construct a situation where there is an 
> unknown like there would in the case of something like :has() (sigh, or 
> the subject token if we must ;)). 
> Of course, the whole idea of a proposal is that it can have counter 
> proposals and I think perhaps you might have just made one - personally 
> I care much more about a good discussion and competition of ideas than 
> I do getting specifically this, but this seems very doable to me. 
> -Brian 		 	   		  

Received on Wednesday, 13 March 2013 18:54:07 UTC