W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: List of selectors under consideration for Selectors Level 4?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 17 Aug 2012 09:56:12 -0700
Message-ID: <CAAWBYDDFX+eshZ-qWjkab9K=PiwmpW6opXFb546K=QEQVxMRrQ@mail.gmail.com>
To: Greg Houston <gregory.houston@gmail.com>
Cc: fantasai <fantasai.lists@inkedblade.net>, www-style@w3.org
On Fri, Aug 17, 2012 at 12:21 AM, Greg Houston
<gregory.houston@gmail.com> wrote:
> On Fri, Aug 17, 2012 at 1:27 AM, fantasai <fantasai.lists@inkedblade.net> wrote:
>> On 08/16/2012 11:22 AM, Greg Houston wrote:
>>> How do you write the opposite of .panel>  header>  .btn?
>>> :matches(!panel>  :matches(!header>  .btn))
>> Not sure what you mean by "opposite". If you want to select the
>> .panel instead of the .btn, you write
>>   !.panel > header > .btn
> Ah. I misunderstood the scope of the !. I was thinking it only worked
> with two elements, but from what you wrote it seems to change the
> direction of all the selectors following it regardless of how many
> there are. I think if the example in the draft was !OL > LI:only-child
>> a instead of just OL > LI:only-child this would be a lot clearer.
> .row > .span3 > :matches( !.panel > header > .float-right > .btn) > footer
> Would the above be the selector for a footer that is a child of .row >
> .span3 > .panel when that .panel contains > header > .float-right >
> .btn?


On Fri, Aug 17, 2012 at 6:07 AM, Brian Kardell <bkardell@gmail.com> wrote:
> Since selectors L4 is being worked on now, I would like to beg once again
> that it be :has().  Greg can verify, but I bet he would not have made that
> mistake if it were written:
> .panel:has(> header > .btn)
> Fantasai, I know you have been throwing this particular use case
> (combinator) out since like 2000 wrt :has vs single character, but it really
> does seem easily grokable and has been proposed by so many people (not just
> list people, members too)... it works in jquery and in my own hitchjs that
> way and maybe yehuda can speak for jquery which is way more popular, but I
> have never heard a peep about that from users.
> Pleeeeeaassseee :)

I agree.  I like the simplicity of ! when it's just moving the
subject, but I dislike the way you have to rewrite your selector when
you then want to descend further.  "A B:has(C) D" is way more
convenient to read and write than "A :matches(!B C) D".

I'm completely fine with the fact that :has() is strictly duplicating
functionality that you already have just be combining ! and
:matches(). It's better for authors.

Received on Friday, 17 August 2012 16:56:59 UTC

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