Intent to Implement and Ship: Selectors Level 4: Complex :not()

1,149 views
Skip to first unread message

Anders Hartvoll Ruud

unread,
Oct 19, 2020, 8:41:34 AM10/19/20
to blink-dev

Contact emails

and...@chromium.org

Specification

https://drafts.csswg.org/selectors/#negation

Summary

This adds support for complex selector lists inside the :not() pseudo-class. In other words, you can use combinators inside :not(), e.g. p:not(article *) selects all <p> elements that are not descendants of <article>.

Before Selectors Level 4, only a single simple selector was allowed inside :not(), and this is also how it's currently implemented in Blink. However, with the introduction (I2S) of :is() and :where(), the restriction is effectively lifted, because :is() is a simple selector that accepts a complex selector list inside it. In other words, :not(:is(<complex-selector>)) is allowed, even with the Selectors Level 3 definition of :not(). Therefore, since :is()/:where() effectively allows it anyway, I suggest that we allow complex selectors directly in :not() as well.

The underlying work to support this is already done via :is()/:where(), so this should mostly be a matter of turning it on and writing WPTs.

Blink component

Blink>CSS

TAG review

Likely not needed, since this is a minor variation of existing features.


Risks


Interoperability and Compatibility


Gecko: Requesting an official position seemed like overkill here, so I just asked Emilio why it's not shipped in Firefox, and it's just because they haven't gotten around to it yet. (See Chromium Slack, #style channel). If that's not good enough, I'll request a position.

WebKit: Shipped a long time ago, see Blog Post (section "Rejecting Complete Selectors").

Web developers: No signals


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes


Is this feature fully tested by web-platform-tests?

Not yet - I'll need to add tests during implementation.


(There is some coverage via :is()/:where(), but not enough).

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1139865

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5014164156186624

Daniel Bratell

unread,
Oct 22, 2020, 2:50:35 PM10/22/20
to Anders Hartvoll Ruud, blink-dev

LGTM1

Please make sure there is at least a bug in Gecko's world to make it harder for them to forget it.

/Daniel

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKFBnUo0bxK_Tn8iC4O01eVymVFEuhVoGvLhKoT3zm%2BHpQYWjA%40mail.gmail.com.

Manuel Rego Casasnovas

unread,
Oct 22, 2020, 2:55:37 PM10/22/20
to blin...@chromium.org
LGTM2

On 22/10/2020 20:50, Daniel Bratell wrote:
> LGTM1
>
> Please make sure there is at least a bug in Gecko's world to make it
> harder for them to forget it.
>
> /Daniel
>
> On 2020-10-19 14:40, Anders Hartvoll Ruud wrote:
>>
>>
>> Contact emails
>>
>>
>> and...@chromium.org <mailto:and...@chromium.org>
>>
>>
>> Specification
>>
>>
>> https://drafts.csswg.org/selectors/#negation
>>
>>
>> Summary
>>
>> This adds support for complex selector lists inside the
>> :not()pseudo-class. In other words, you can use combinators inside
>> :not(), e.g. p:not(article *)selects all <p>elements that are not
>> descendants of <article>.
>> Before Selectors Level 4, only a single simple selector
>> <https://drafts.csswg.org/selectors/#simple>was allowed inside :not(),
>> and this is also how it's currently implemented in Blink. However,
>> with the introduction (I2S
>> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKFBnUrj-bWBU3VeTD79GKSGbsw5Ox2UXDvarBdZY-eVLfJNQw%40mail.gmail.com?utm_medium=email&utm_source=footer>)
>> of :is()and :where(), the restriction is effectively lifted, because
>> :is()is a simple selector that accepts a complex selector list inside
>> it. In other words, :not(:is(<complex-selector>))is allowed, even with
>> the Selectors Level 3 definition of :not(). Therefore, since
>> :is()/:where()effectively allows it anyway, I suggest that we allow
>> complex selectors directly in :not()as well.
>> The underlying work to support this is already done via
>> :is()/:where(), so this should mostly be a matter of turning it on and
>> writing WPTs.
>>
>>
>> Blink component
>>
>>
>> Blink>CSS
>> <https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3ECSS>
>>
>>
>> TAG review
>>
>>
>> Likely not needed, since this is a minor variation of existing
>> features.
>>
>>
>>
>> Risks
>>
>>
>>
>> Interoperability and Compatibility
>>
>>
>> Gecko: Requesting an official position seemed like overkill
>> here, so I just asked Emilio why it's not shipped in Firefox,
>> and it's just because they haven't gotten around to it yet.
>> (See Chromium Slack, #style channel). If that's not good
>> enough, I'll request a position.
>>
>> WebKit: Shipped a long time ago, see Blog Post (section
>> "Rejecting Complete Selectors")
>> <https://webkit.org/blog/3615/css-selectors-inside-selectors-discover-matches-not-and-nth-child/>.
>>
>> Web developers: No signals
>>
>>
>> Will this feature be supported on all six Blink platforms
>> (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
>>
>>
>> Yes
>>
>>
>> Is this feature fully tested by web-platform-tests
>> <https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md>?
>>
>>
>> Not yet - I'll need to add tests during implementation.
>>
>>
>>
>> (There is /some/ coverage via :is()/:where(), but not enough).
>>
>>
>> Tracking bug
>>
>>
>> https://bugs.chromium.org/p/chromium/issues/detail?id=1139865
>>
>>
>> Link to entry on the Chrome Platform Status
>>
>>
>> https://chromestatus.com/feature/5014164156186624
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "blink-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to blink-dev+...@chromium.org
>> <mailto:blink-dev+...@chromium.org>.
>> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKFBnUo0bxK_Tn8iC4O01eVymVFEuhVoGvLhKoT3zm%2BHpQYWjA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blink-dev+...@chromium.org
> <mailto:blink-dev+...@chromium.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/379e10de-347c-ae4c-272c-3ad97cc05dfb%40gmail.com
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/379e10de-347c-ae4c-272c-3ad97cc05dfb%40gmail.com?utm_medium=email&utm_source=footer>.

yo...@yoav.ws

unread,
Oct 22, 2020, 3:12:34 PM10/22/20
to blink-dev, Manuel Rego
LGTM3

Anders Hartvoll Ruud

unread,
Oct 22, 2020, 4:24:43 PM10/22/20
to Daniel Bratell, blink-dev
On Thu, Oct 22, 2020 at 8:50 PM Daniel Bratell <brat...@gmail.com> wrote:

LGTM1

Please make sure there is at least a bug in Gecko's world to make it harder for them to forget it.

Reply all
Reply to author
Forward
0 new messages