- From: Westbrook Johnson via GitHub <sysbot+gh@w3.org>
- Date: Thu, 13 Mar 2025 02:44:25 +0000
- To: public-css-archive@w3.org
`:host-context()` doesn't have a ceiling bound. No matter the shadow boundaries ABOVE a `:host` the "context" _must_ be presented whereas `:host(:has(...))` outlines a relationship between an element `:host` and the light DOM children related to it.
```
<body class="this-context">
<this-el>
#shadow-root
<that-el>
#shadow-root
<style>
:host-context(.this-context) {
/* styles because of realities outside of the current DOM tree */
}
</style>
</that-el>
</this-el>
</body>
```
VS
```
<this-el>
#shadow-root
<style>
:host(:has(that-el)) {
background-color: green;
}
:host(:has(other-el)) {
/* never acheived */
background-color: red;
}
</style>
<slot></slot>
<that-el>
#shadow-root
<other-el></other-el>
</that-el>
</this-el>
```
--
GitHub Notification of comment by Westbrook
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11859#issuecomment-2719657975 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 13 March 2025 02:44:26 UTC