Skip to content

[css-values-5] allow specifying flat vs light tree in sibling-index() and sibling-count() #9562

@argyleink

Description

@argyleink

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:

  • it would disrupt the potential for of <<selector>> syntax to be used between the parenthesis
  • it would depart from the alignment with nth-child()

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 😅

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Friday afternoon

    Status

    Regular agenda

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions