Re: [csswg-drafts] [css-anchor] anchor-name should not leak out of a shadow tree (#7916)

Ah, thanks for reminding me about #5984!

So, argh, this is tough. In 5984 we decided on using a shadow-including ancestor search, *and* to jump straight to a pseudo's originating element when starting that search. This means that a `::part()` in a CQ won't see any containers on elements in the shadow (which is good); instead it'll start looking at the host element. (The ::part() will be able to see a container name set *on* the host element from within the shadow, tho, so there's still *some* shadow-leakage right at the boundary. But boundary leakage on the host is unavoidable so it's okay.) (And you can *set* a container-name using ::part(), which'll be visible to CQs inside the shadow, so there's leakage the other way too. But since light-DOM styles can't *use* a container-name set on a ::part(), there's no reason to ever set that property *except* to purposely screw with a shadow, so that's probably okay.)

<details>
<summary>My previous example's behavior under the 5984 decision</summary>
<p>So in <a href="https://github.com/w3c/csswg-drafts/issues/7916#issuecomment-1291086054">my example</a>, the `part=foo` element in the shadow *does* get a `container-name` from the light DOM styles, which is visible to the CQ in the shadow (possibly inadvertently). This causes the CQ in the shadow to fail, since the nearest "shadow" container for #child is 150px wide, not 200px.  The subsequent light-DOM CQ *also* fails, since it starts searching at the host element, not the part in the shadow tree, and thus sees a "shadow" container that is 200px wide, not 150px.
</details>

But this worked because we're doing this stuff at selector-resolution time, where we *know* that we're resolving a pseudo-element reference.  Is it still possible to do when the search is initiated due to a *property value* rather than a selector? That's well after we're done with Selectors. 

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


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

Received on Tuesday, 29 November 2022 22:33:55 UTC