Bug 1987926 Comment 2 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I think this is a side effect of missing this little part of [the spec](https://drafts.csswg.org/css-anchor-position-1/#target-anchor-element):

> The anchor name is a tree-scoped name, while anchor spec is a tree-scoped reference.

This means we probably require keeping track of shadow root/document [root of the declaration](https://drafts.csswg.org/css-scoping-1/#css-tree-scoped-reference). From my experience with @scope and implicit root, this could get tricky, esp. due to shadow DOM stylesheet sharing - See changes around [here](https://searchfox.org/firefox-main/rev/4a1256a814d330833bb9ff484f069ec65f070969/servo/components/style/stylist.rs#2794-2800).

We could cheat and block referencing anchors across shadow boundaries, but then `/css/css-anchor-position/anchor-name-cross-shadow.html` would start failing. In fact, that test makes me think that we can't really cheat our way out of tracking the declaration site.
I think this is a side effect of missing this little part of [the spec](https://drafts.csswg.org/css-anchor-position-1/#target-anchor-element):

> The anchor name is a tree-scoped name, while anchor spec is a tree-scoped reference.

This means we probably require keeping track of shadow root/document [root of the declaration](https://drafts.csswg.org/css-scoping-1/#css-tree-scoped-reference). From my experience with @scope and implicit root, this could get tricky, esp. due to shadow DOM stylesheet sharing - See changes associated with [this code](https://searchfox.org/firefox-main/rev/4a1256a814d330833bb9ff484f069ec65f070969/servo/components/style/stylist.rs#2794-2800).

We could cheat and block referencing anchors across shadow boundaries, but then `/css/css-anchor-position/anchor-name-cross-shadow.html` would start failing. In fact, that test makes me think that we can't really cheat our way out of tracking the declaration site.

Back to Bug 1987926 Comment 2