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

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

From: Brian Kardell <bkardell@gmail.com>
Date: Wed, 13 Mar 2013 15:27:02 -0400
Message-ID: <CADC=+jf2h6rkFrEDjEB4fM+4FWzyL=3gOyTUGmXLTSg13A0aQg@mail.gmail.com>
To: Clint Hill <clint.hill@gmail.com>
Cc: Henrik Andersson <henke@henke37.cjb.net>, François REMY <francois.remy.dev@outlook.com>, "liam@w3.org" <liam@w3.org>, Bjoern Hoehrmann <derhoermi@gmx.net>, "www-style@w3.org" <www-style@w3.org>
On Wed, Mar 13, 2013 at 3:09 PM, Clint Hill <clint.hill@gmail.com> wrote:

> Boolean Algebra certainly. But wouldn't syntax make that easier?
> On 3/13/13 12:01 PM, "Henrik Andersson" <henke@henke37.cjb.net> wrote:
> >François REMY skriver:
> >> 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)
> >>
> >>
> >
> >Boolean algebra says that you can fake and using or. !(!X || !Y) == X &&
> >Y It works in the other direction too. !(!X && !Y) == X || Y
> >
> >

If you are saying that would make things possible, sure.  We fake all of
this stuff using just 1's and 0's - but I wouldn't want to write them all
:)  I think generally speaking I am talking about looking at possibilities
of what you can do with sets or gates for some language that makes
interesting and useful selection on trees that require less close binding
to the structures that they style... As I said in the intro (IIRC) of the
linked post - it's very often the case that people still write HTML
structures with CSS because html itself wasn't rich enough in tags/concepts
originally and CSS selectors (and maybe beyond selectors) weren't powerful
enough to avoid that and achieve the complex things people go for.

Selectors are used for all sorts of things beyond just CSS too - robust
sorts of ways to select are really useful and it seems to me that
sets/gates have a lot of history and power around them already.  If we can
take that and create something not impossibly complex (I honestly don't
think this is because of how I have proposed it - should be close to
existing implementations on a number of things, not hurt progressive
rendering, etc) that seems like it's worth considering.

Brian Kardell :: @briankardell :: hitchjs.com
Received on Wednesday, 13 March 2013 19:27:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:27 UTC