Re: [csswg-drafts] [css-values] Proposal: add sibling-count() and sibling-index() (#4559)

I like the flexibility of the `index()` and `count()` concept, especially
if a selector could be passed in.

A few possibilities that would be great to see:

* `count(children)` for the number of child elements (akin to `count(“>
*”)`)

* `count(“.media”)` for counting the children matching a selector

* `count(siblings)` for getting parent’s element count minus 1.

* `index(siblings)` for getting the element’s index relative to its siblings

* `index(n)` for getting the n value in :nth-child loops for more advanced
selecting

Imagine using `count()` to help you determine the number of `grid-columns`!

I realize not all of those would be feasible or possible initially, but
having open ended functions could allow their expansion in the future.

On Thu, Dec 5, 2019 at 6:29 AM Jake Archibald <notifications@github.com>
wrote:

> I don't mind too much between index(element) vs index-element().
>
> CSS doesn't really allow you to interact with non-element nodes so adding
> something like index(node) would be pretty new.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/w3c/csswg-drafts/issues/4559?email_source=notifications&email_token=AAF5XQ7IHBYYPECY33P7YPLQXDX25A5CNFSM4JVMOSQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGARTOQ#issuecomment-562108858>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAF5XQ2WXC4PK22URETC4DDQXDX25ANCNFSM4JVMOSQA>
> .
>


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

Received on Thursday, 5 December 2019 14:17:11 UTC