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

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

From: Greg Houston <gregory.houston@gmail.com>
Date: Thu, 16 Aug 2012 13:22:43 -0500
Message-ID: <CAOtq01DQxOReazqSK62E8z9v6SnFyoDabhk2hUFRcn=Z=a4noA@mail.gmail.com>
To: "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
On Thu, Aug 16, 2012 at 10:07 AM, Marat Tanalin | tanalin.com
<mtanalin@yandex.ru> wrote:
> 16.08.2012, 18:46, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> Instead of "p - ul" (select a <ul> whose following sibling is a <p>),
>> do "!ul + p".  Same selector as always, but the ! tells the engine
>> which element is the "subject" of the selector.
>>
>> As Marat says, you can combine this with :matches() if you then want
>> to chain off of the element.
>
> Marat said this combination is horrible compared with previous-sibling combinator.

Thanks everyone. Yeah, ":matches(!UL + P) > LI" is definitely way more
confusing than "P - UL > LI", but I am glad there is a way to do it
none-the-less. It seems that some of the more commonly used variations
on the use of :matches(!) could use their own selectors, e.g.,
previous-sibling and jQuery's .closest(), .parent(), and parents().

.closest()
Get the first element that matches the selector, beginning at the
current element and progressing up through the DOM tree.

How do you write the opposite of .panel > header > .btn?
:matches(!panel > :matches(!header > .btn))

I gave it a go, but probably didn't get it right. It's definitely confusing.
Received on Thursday, 16 August 2012 18:23:11 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT