-
Notifications
You must be signed in to change notification settings - Fork 83
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
Selectors - and indexed pseudo classes #2168
Conversation
features/nth-child.yml
Outdated
@@ -1,6 +1,19 @@ | |||
name: ":nth-child() (initial support)" | |||
description: "The `:nth-child()` and `:nth-last-child()` CSS functional pseudo-classes match elements by the relative position of elements (first, second, third, fourth, and so on), counted from the first or last sibling." | |||
description: "The `:nth-child()` and `:nth-last-child()` CSS functional pseudo-classes match elements by their relative position, counted from the first or last sibling. The `:first-child`, `:last-child`, and `:only-child` pseudo-classes represent common use cases." |
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.
Position within what?
Possible suggestion:
description: "The `:nth-child()` and `:nth-last-child()` CSS functional pseudo-classes match elements by their relative position, counted from the first or last sibling. The `:first-child`, `:last-child`, and `:only-child` pseudo-classes represent common use cases." | |
description: "The `:nth-child()` and `:nth-last-child()` CSS functional pseudo-classes match elements based on their relative position within a list of elements, counted from the first or last sibling. The `:first-child`, `:last-child`, and `:only-child` pseudo-classes represent common use cases." |
Also, "represent common use cases" feels improvable. This doesn't describe what these pseudos do.
- css.selectors.first-child.no_parent_required | ||
- css.selectors.last-child.no_parent_required | ||
- css.selectors.nth-child.no_parent_required | ||
- css.selectors.nth-last-child.no_parent_required | ||
- css.selectors.only-child.no_parent_required |
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.
I'm unclear as to what these subfeatures cover. Can you help me understand?
Would they make sense as a separate feature?
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.
Selectors level 3 had text referring to the children's parent, but selectors level 4 adds the note-
As there was no reason to exclude them from matching elements without parents, or with non-element parents, they have been rephrased to refer to an element’s relative index amongst its siblings.
For instance, the document root matches :first-child
despite having no parent.
This doesn't seem like a feature to me. It also looks like Safari data might be incorrect, as document.documentElement.matches(":first-child")
returns true in Safari.
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.
Thanks! Keeping them here, ignored, seems right then.
features/nth-of-type.yml
Outdated
@@ -0,0 +1,10 @@ | |||
name: ":nth-of-type() pseudo-classes" | |||
description: "The `:nth-of-type()` CSS functional pseudo-classes match elements based on their position among siblings of the same type, counted from the first or last sibling. The `:only-of-type` pseudo-class matches any element that is the only child of its type, of its parent." |
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 first sentence only mentions :nth-of-type()
, but uses the plural "pseudo-classes", which feels odd.
We might want to list all the pseudo-classes, like we do in the nth-child feature above.
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.
I updated this- it's a lot to cram into 300 characters, and I'd welcome other verbage.
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.
Approved, modulo my comment about the "(initial support)" note, which I don't think we need, but could be convinced otherwise.
- css.selectors.first-child.no_parent_required | ||
- css.selectors.last-child.no_parent_required | ||
- css.selectors.nth-child.no_parent_required | ||
- css.selectors.nth-last-child.no_parent_required | ||
- css.selectors.only-child.no_parent_required |
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.
Thanks! Keeping them here, ignored, seems right then.
Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
See #2170 for more info