-
Notifications
You must be signed in to change notification settings - Fork 717
[css-values-5] Introduce sibling-index()
and sibling-count()
(#4559)
#9134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
css-values-5/Overview.bs
Outdated
|
||
Issue: Describe when it actually resolves. Computed Value? Used Value? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely resolves computed-value-time, no reason to wait any longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in af5ce47
css-values-5/Overview.bs
Outdated
Getting the position of an element within its siblings: the ''sibling-index()'' function</h3> | ||
|
||
The <dfn>sibling-index()</dfn> function resolves to the position | ||
of an element within its group of <a>inclusive siblings</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to clarify that it's the inclusive flat tree siblings, which is what we want (I assume).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified in 30de15b, but not sure if my wording is 100% correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use flat tree order for :nth-child(). I think we want :nth-*() and sibling-index() to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits. Also, I'd add a few small examples to show them off.
██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ████ ██ ██ | ||
██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ███ ██ ██ | ||
████████ ████████ ████████ ██ ██ ████████ ██ ██ ██ ██████ ███████ ███████ ██ ██ ██ ████ ██ ██ ██████ | ||
--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Keep these headings as short as possible; if they wrap (as they definitely will on many screens, given how long these lines are) they become unreadable. I'd probably just do "COUNT" or maybe two lines having "INDEX" and "COUNT".
|
||
The ''sibling-index()'' and ''sibling-count()'' functions | ||
(the <dfn export for=CSS>element counting functions</dfn>) | ||
allow authors to take these factors into account in ''calc()'' expressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow authors to take these factors into account in ''calc()'' expressions. | |
allow authors to take these factors into account anywhere that allows <<integer>>s, | |
such as in [=math functions=]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just a light rewrite to avoid implying that these are only valid in calc().)
allow authors to take these factors into account in ''calc()'' expressions. | ||
|
||
With these, authors can create things like staggered animation delays | ||
or easily position elements on a circle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or easily position elements on a circle. | |
or easily position elements evenly around a circle. |
The <dfn>sibling-index()</dfn> function resolves to the position | ||
of an element within its group of <a>inclusive siblings</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <dfn>sibling-index()</dfn> function resolves to the position | |
of an element within its group of <a>inclusive siblings</a> | |
The <dfn>sibling-index()</dfn> function resolves to the <<integer>> | |
representing the element's index within its list of <a>inclusive siblings</a> |
The <dfn>sibling-count()</dfn> function resolves to the total number of | ||
<a>inclusive siblings</a> in the <a>flat tree</a> an element is part of. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <dfn>sibling-count()</dfn> function resolves to the total number of | |
<a>inclusive siblings</a> in the <a>flat tree</a> an element is part of. | |
The <dfn>sibling-count()</dfn> function resolves to the <<integer>> | |
representing the total number of the element's <a>inclusive siblings</a> | |
in the <a>flat tree</a>. |
With 762eace, I guess this can be closed. |
Yes, thanks for closing this one @Loirooriol. I was preoccupied with Other Important Things™ + some time OOO, so never got round to reviewing the suggested changes in this thread. |
A first, and possible naive, attempt at speccing
sibling-index()
andsibling-count()
. Very much open to feedback on how to do this properly.