W3C home > Mailing lists > Public > www-style@w3.org > March 2013

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

From: François REMY <francois.remy.dev@outlook.com>
Date: Wed, 13 Mar 2013 19:53:39 +0100
Message-ID: <DUB002-W478F2EF878C209CBA4E680A5E30@phx.gbl>
To: Brian Kardell <bkardell@gmail.com>, "liam@w3.org" <liam@w3.org>
CC: Bjoern Hoehrmann <derhoermi@gmx.net>, "www-style@w3.org" <www-style@w3.org>
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: bkardell@gmail.com 
> To: liam@w3.org 
> CC: derhoermi@gmx.net; www-style@w3.org 
> Subject: Re: [css-selectors] Proposal: Logical Combinators / Sets 
> 
> 
> 
> 
> On Wed, Mar 13, 2013 at 2:25 PM, Liam R E Quin 
> <liam@w3.org<mailto:liam@w3.org>> 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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:06 GMT