Re: [csswg-drafts] [selectors] The forgiving nature of :has breaks jQuery when used with a complex :has selector (#7676)

We use `:has(:has(any))` as a feature detection for a polyfill for `querySelectorAll(:has(...))`. This polyfill in turn is used to polyfill `:has` in CSS. (https://github.com/csstools/postcss-plugins)

With Chrome now matching [Safari's (buggy) behaviour](https://github.com/w3c/csswg-drafts/issues/6952#issuecomment-1159279009) we override the native implementation and apply the polyfill.

We obviously don't have the reach of jQuery but it seems important to resolve this asap before too many things depend on the current specification.

------

The current behaviour with a partially forgiving selector is really confusing.
It becomes tricky to know when and how this selector list is valid or invalid :

```css
.anything,
:has(:something-only-supported-from-chrome-200-safari-50-firefox-200) {
  color: green;
}
```

Renaming `:has()` or making it fully unforgiving seems better in the long run while still doing something to prevent breakage.
(old jQuery eventually goes away)

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 17 September 2022 13:21:30 UTC