Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to prototype: Allow :is() and :where() to have better selector error recovery.

92 views
Skip to first unread message

Emilio Cobos Álvarez

unread,
Sep 13, 2020, 6:24:13 PM9/13/20
to dev-pl...@lists.mozilla.org
Summary: Allow invalid selectors inside :is() and :where() to be
ignored, rather than making the whole selector list invalid.

This would allow to have some sort of escape hatch for the usual footgun
of "one invalid selector in the list makes the whole style rule
invalid", which is generally considered a mistake
<https://wiki.csswg.org/ideas/mistakes>.

This is technically a breaking change, see below for the position of
other engines on this (though these pseudo-classes are relatively
recent, and we're being more permissive). The intention is to enable the
pref on Nightly and Early Beta for now. You'll hear from me when
enabling it everywhere :)

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1664718
<https://bugzilla.mozilla.org/show_bug.cgi?id=1664718>

Standard: This implements the resolution for csswg-drafts#3264
<https://github.com/w3c/csswg-drafts/issues/3264>. The spec is yet to be
edited to reflect it.

Platform coverage: All

Preference: layout.css.is-and-where-better-error-recovery.enabled

DevTools bug: I'm not sure if it is necessary to have a devtools bug for
this. The selector will serialize as :is(div) rather than :is(div,
:nonsense), for example. Other than that, devtools should just work. If
folks feel strongly otherwise, please file a bug and cc me on it and
I'll take a look, maybe some more work could be done to surface this
better in DevTools, though it wouldn't be trivial right now to expose it
via the regular CSS parse error reporting mechanism (because parsing
will, in fact, succeed).

Other browsers: Both Blink and Apple engineers have expressed support
for this. Blink still doesn't implement these selectors, Apple engineers
said on the call that they'd follow Gecko if we make the change.

web-platform-tests: Tests for this are added in the bug.

 -- Emilio

Sebastian Zartner

unread,
Sep 14, 2020, 2:06:56 AM9/14/20
to
On Monday, September 14, 2020 at 12:24:13 AM UTC+2, Emilio Cobos Álvarez wrote:
> DevTools bug: I'm not sure if it is necessary to have a devtools bug for
> this. The selector will serialize as :is(div) rather than :is(div,
> :nonsense), for example. Other than that, devtools should just work. If
> folks feel strongly otherwise, please file a bug and cc me on it and
> I'll take a look, maybe some more work could be done to surface this
> better in DevTools, though it wouldn't be trivial right now to expose it
> via the regular CSS parse error reporting mechanism (because parsing
> will, in fact, succeed).

Authors would definitely benefit from knowing that selectors within :is() and :where() are invalid, allowing them to correct those errors. Therefore I've created https://bugzilla.mozilla.org/show_bug.cgi?id=1664739 and https://bugzilla.mozilla.org/show_bug.cgi?id=1664740 for two ways how to expose this info to them.

Sebastian
0 new messages