W3C home > Mailing lists > Public > www-style@w3.org > February 2015

Re: [selectors] Previous-sibling combinator?

From: Clive Chan <doobahead@gmail.com>
Date: Sun, 08 Feb 2015 15:32:49 +0000
Message-ID: <CALB6_+gfvb97urjwCiG17tJ5e1KPxr375Keug1-pTt-WiG7ASQ@mail.gmail.com> (sfid-20150208_153255_320574_FFE82E78)
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Henrik Andersson <henke@henke37.cjb.net>, www-style list <www-style@w3.org>
I feel like ~ should have been used for previous-sibling, since it's
sometimes used as a negation operator. And then just use ++ or ~~ to
indicate the "all after/before" combinators. The ship has long sailed for
that, though, unless we're planning on breaking backwards compat.

I like the idea of requiring spaces around the dash - it'll actually force
people to write nicely spaced out CSS combinators, haha - but it does break
typical naming conventions. Hm. I'm still for it, though.

Or we could use more wordy things such as :siblings, :siblings:before,
:siblings:after, similarly to the jQuery .siblings() function (do any
frameworks have CSS-ified syntax for all-siblings yet?).



On Sat, Feb 7, 2015 at 9:45 PM, Brad Kemper <brad.kemper@gmail.com> wrote:

>
> > On Feb 3, 2015, at 8:17 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> >
> > That said, I'm not certain this should be a combinator at all.  We can
> > instead put :has() in the fast profile if we limit it to only
> > containing + (and > ?) combinators.
>
> I'm for that, but I'd add the "following sibling" combinator (~) also, to
> get everything that has subsequent siblings. That should be no worse that +.
>
> Then to get something that has any P siblings, you would do this:
>
> :matches(:has(*~P), P~*)
>
> And these two would be equivalent:
>
> :matches(:has(*~), ~*)
> :not(:only-child)
>
>
>
Received on Wednesday, 11 February 2015 19:53:27 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:28 UTC