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

On Wed, Mar 13, 2013 at 11:50 AM, Bjoern Hoehrmann <derhoermi@gmx.net>wrote:

> * Brian Kardell wrote:
> >Just wondering if anyone had any thoughts on this - I've received some
> >positive off-list feedback, but there has been literally no comment here
> >from anyone.  I feel like it's a good idea (obviously, or I wouldn't have
> >proposed) and I'd hate to see it die just because I posted at a bad time
> or
> >something.
>
> I looked at your proposal when you posted it here and my main takeaway
> was that in `.cars div:allof(.new .quality, .domestic .performance) p`
> I have no intuitive sense for what that might match, which is one re-
> quirement I would have for new selector syntax. Part of the problem may
> be that pseudo-classes are conditionals, so div:allof(...) matches div
> elements iff ... what?
> --
> Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
> Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
> 25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
>


I provided examples in the post and a link to docs for the prollyfill (
http://hitchjs.com/describe/native.html#logical) which try to provide some
rationale.  Each of them relate more or less to logic gates and they are
the equivalent of checking the JavaScript API "matchesSelector" on each
thing in the filter and then operating based on whether the gate is opened
or closed.

- :allof(...)  as proposed ANDs the selectors together and only selects if
all of them are true (thus the proposed name).

Imagining an page with lots of data on people with local semantics
organizing them by country, then occupation, then something else, etc...
 You might choose to style just any unemployed person which
is hierarchically descended from an element with their occupation being a
designer, their country being us.  Using logical language there is any
number of ways to construct rich selections - here is just one using
allOf(...)

.person:allOf( [occupation='designers'] *, [country='US'] *).unemployed{
.... }


Of course, if they could just have names like :and(), :xor() - that works
too but I think it is a little less keeping with the language.


-- 
Brian Kardell :: @briankardell :: hitchjs.com

Received on Wednesday, 13 March 2013 16:20:37 UTC