Open cdoublev opened 1 year ago
Chrome and FF seem to disagree on forgiving invalid selectors in
selector()
Isn't that because Chrome hasn't landed unforgiving parsing in selector()
yet?
https://groups.google.com/a/chromium.org/g/blink-dev/c/RJrIxJA9LYw
With the Experimental Web Platform features flag enabled in Canary, I see the test matches Firefox.
Ok, I only checked the browser compat table.
I am fine with unforgiving parsing (minus the observation in my previous comment) but the related note (quoted below) seems a bit handwavy to justify evaluating selector(:is())
to false:
Note: Some functional selectors are parsed forgivingly, i.e. if some arguments are unknown/invalid, the selector itself is not invalidated. These are nonetheless unsupported
Resolving to false means that :is()
take <selector-list>
(list cannot be empty) instead of <forgiving-selector-list>
(list can be empty). I mean, this is not a context rule applying on the result of <forgiving-selector-list>
, whereas restrictions apply when pseudo-classing a pseudo-element, for example.
It has been resolved to disable forgiving parsing in
selector()
. The initial motivation was to add styles based on user agent restrictions on:has()
argument, which was previously<forgiving-relative-selector-list>
but is now<relative-selector-list>
.Outdated browser interoperability issue
Chrome and FF seem to disagree on forgiving invalid selectors in `selector()`: in the following test case, `text` is red, not underlined in Chrome, and is neither red or underlined in FF. ```htmlI do not have a strong opinion but I find it a bit surprising that
selector(:is(::before, div))
must evaluate tofalse
whereas:is(::before, div)
selects anydiv
. If the author wants to test the support of pseudo-elements, he can writeselector(::pseudo)
orselector(:not(::pseudo, ::another-pseudo))
.