[css-values-5] allow specifying flat vs light tree in sibling-index() and sibling-count() · Issue #9562 · w3c/csswg-drafts (original) (raw)

In a goal to allow author flexibility with sibling-index() and sibling-count() and the value resolution from the flat tree vs the light tree, I propose adding a parameter to the functions so developers may specify which tree they need. This would allow developers to work with happy path default flat tree default behavior, but when needed they can specify resolution against the light dom.

ul { li { animation-duration: calc(sibling-index() * 50ms); } }

:host { li { animation-duration: calc(sibling-index(light-tree) * 50ms); } }

Trade offs:

Use cases:
I don't really have any example use cases for wanting light tree, but the fact there are two trees to resolve against makes me think eventually someone will show up with a use case 😅