[csswg-drafts] [css-values] Pseudo-elements shouldn't defer sibling-index() and sibling-count() to its ultimate originating element (#9573)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-values] Pseudo-elements shouldn't defer sibling-index() and sibling-count() to its ultimate originating element ==
There is a conflict when a pseudo-element is also a full fledged element. For example,

```css
slot::slotted(*) {
  z-index: sibling-index();
}
```

should probably use the index of the slotted elements, not the index of the slot where they are slotted.

Even in more normal cases like `::after`, I tend to think authors would prefer `sibling-index()` to be the number of children of the originating element + 1 rather than the index of the originating element. Though this seems complex in general, so rather than providing a surprising value, it's probably better to handle it as an error just like #9572 will handle non-matching elements.

That is, we would default `sibling-index()` to use a `*|*` selector, and then when used on an `::after`, it won't match, so just treat this consistently with #9572. But `sibling-index(::after)` would match, so we would get 1. For simplicity, I guess we could say that pseudo-elements that aren't full fledged elements aren't considered to have siblings.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9573 using your GitHub account


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

Received on Wednesday, 8 November 2023 14:42:31 UTC