Re: [csswg-drafts] [selectors-4] Should `:has()` be a complex selector? (#10756)

@sorvell: What I tried to clarify in this issue is not about the `:has()` usage in `:host()` but about the different behavior what you pointed:

> * Chrome 128: does not match at all
> * Firefox 129: matches compound selector, e.g. :host(:has(div))
> * Safari 17.5: matches complex selector, e.g. :host(:has(div div))

Chrome and Firefox follow the agreement in https://github.com/w3c/csswg-drafts/issues/5093#issuecomment-1344819653 that passes restrictions to the argument of logical combinations. So `:host(:has(div div))` is invalid in both browsers due to the `compound-selector` restriction on `:host()` argument.

But it seems that there is a conflict between Firefox and Chrome on `:host(:has(div))` case.

Firefox allows `:host(:has(div))` case because it seems to treat the `div` inside `:has()` as a compound selector. If the `div` is a compound selector, we can say that Firefox follows the `compound-selector` restriction in this case.

Chrome doesn't allow `:host(:has(div))` case because it treats the `div` inside `:has()` as a non-compound selector. If the `div` is not a compound selector, we can say that Chrome follows the `compound-selector` restriction in this case.

I think that, clarifying this conflict would be helpful for the general discussion of `:has()` usage inside `:host()` because we can narrow down the case as supporting complex selector inside `:host()`. (For me, `:host(.a:has(div))`, `:host(.a:has(> div))`, `:host(:is(div .a)`, `:host(:is(div > .a))` looks similar cases that check parent/child relationship inside `:host()`)

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


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

Received on Monday, 26 August 2024 07:35:31 UTC