Re: [csswg-drafts] [selectors] Let :is() have better error-recovery behavior than normal Selectors (#3264)

I agree that we could minimize the Web-compat risk by saying that error recovery only applies if two or more selectors are supplied.

`:nth-last-child(:nonsense)` is invalid
`:nth-child(:nonsense, :enabled)` is `:nth-child(:enabled)`
`:not(:nonsense, :gibberish)` is `*`
`:is(:nonsense, :gibberish)` is `:not(*)`.

This would have the following benefits:

* `:not(.)` and `:nth-child(.)` and `:nth-last-child(.)` with a single selector have the same semantics as in Selectors 3.
* We have error recovery for `:is(...)` and `:where(...)` and `:has(...)`
* `:not(...)` and `:is(:not(...))` and `:not(:is(...))` are always equivalent, same for `:nth-child` and `:nth-last-child`

As a minor variation, preserving the same benefits, we could say that error recovery only applies if at least one of the selectors is valid. Then

`:not(:nonsense, :gibberish)` is invalid.

This might be easier to teach, and avoid developers' confusion when they see an introduced `:not(*)` in a Developer Tool that hasn't preserved raw text.


-- 
GitHub Notification of comment by ewilligers
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3264#issuecomment-441148706 using your GitHub account

Received on Friday, 23 November 2018 03:15:31 UTC