Description
The current sibling combinators are:
- select immediately following sibling if it matches
~ select any following siblings that match
Neither of these can be used to select the first following sibilng that matches. Or the 2nd. I only need the first, in my current application, but could imagine that someone might need the Nth.
This type of selection becomes useful when dealing with a grid containing hundreds or thousands of child elements of different types or classes. Yep, I have such. So the relationships between siblings become far more important when siblings become far more numerous.
It doesn't seem that one can apply the currently defined :first-* to the subset of siblings selected by ~, as those all apply based on parentage, not a selected subgroup.
Some syntax ideas:
A: S1 ~1 S2
S1 ~2 S2
...
B: some other special character than ~ to just mean first, if Nth doesn't sound useful.
C: some new pseudo-class that selects among a group :first-that-matches( selector ), nth-that-matches( selector ), :last-that-matches( selector ), :nth-last-that-matches( selector ). In this syntax, one would write S1 ~ :first-that-matches( S2 )
D: S1 ~:first S2
S1 ~:nth( n-expression ) S2
S1 ~:last S2
S1 ~:nth-last( n-expression ) S2