Re: [csswg-drafts] [selectors][css-scoping] Should :host:(has()) match? (#11859)

`:host-context()` and `:host(:has())` do not have the same shadow piecing performance profile, so while one can lament the loss of `:host-context()` there's no specific need to associate it directly to `:host(:has())`. In fact, it is WebKit's incredibly diverse support for it that brought it to the community that Mozilla has partial support for the selector and Blink has none.

The direct correlation between `div:has()` and `:host(:has())` is important in clarifying the benefits of the selector and it is hard to see how the performance characteristics of the two could be different. `:host(...)` already speaks to the light DOM just the same as selector build from `div` would, there is nothing about the use of `:host(:has())` that would point to a different relationship.

The indirect relationship between `div:has()` and `:host:has()` points to similar (though less explicitly the same) performance characteristics, in that the use of host here points to the `<#shadow-root>` rather than the `<host-element>`, but in practice points to the same performance characteristics in that the rules effected by it all live within a single document.

Myself and the Web Components Community Group very much hope that in accordance with these similarities that it would be possible to afford shadow DOM users the same access to these sorts of parent selecting devices that a flat DOM or `@scope {}` rule user would get in this context.

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


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

Received on Friday, 7 March 2025 00:49:57 UTC