Re: [csswg-drafts] [css-values] attr() and part() / slotted() / element backed pseudo-elements behave inconsistently. (#12721)

Yeah, we could spec this better.

> When the spec reads "if applied to a pseudo-element", does that mean that it depends on the selector being used, not what the actual backing is?

It is _only_ reasonable to "branch" on the what the actual (pseudo)element _is_, IMO. You can apply attr()-containing declarations to (pseudo)elements that don't have any selectors "in use", e.g. stuff in the animation origin.

> It gets a bit funnier for element-backed pseudo-elements tho, where should the attribute be looked at for those?
> 
> Per spec to the originating element, which seems fine, but it's a bit weird to have this **divergence** with `::part()`.

Wait, isn't `::part()` an element-backed pseudo-element? What's the divergence?

The spec handles similar problems for [tree-counting functions](https://drafts.csswg.org/css-values-5/#tree-counting). We should probably try to keep consistent with that.

> leaking attributes out of the shadow tree

Are attribute values more secret than custom properties?

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


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

Received on Wednesday, 3 September 2025 11:24:00 UTC