Skip to content
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

The element matched by :only-of-type do not need a parent element. #30138

Closed
lsc9 opened this issue Nov 9, 2023 · 6 comments · Fixed by #30292
Closed

The element matched by :only-of-type do not need a parent element. #30138

lsc9 opened this issue Nov 9, 2023 · 6 comments · Fixed by #30292
Labels
Content:CSS Cascading Style Sheets docs effort: small This task is a small effort.

Comments

@lsc9
Copy link

lsc9 commented Nov 9, 2023

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/:only-of-type

What specific section or headline is this issue about?

The selected element does not have to have a parent element

What information was incorrect, unhelpful, or incomplete?

Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required.

What did you expect to see?

remove this note.

Do you have any supporting links, references, or citations?

https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@lsc9 lsc9 added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Nov 9, 2023
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Nov 9, 2023
@pepelsbey
Copy link
Member

Hey! Thank you for bringing this up :)

To be honest, I can’t even find this limitation mentioned in the Level 3 spec. But even if it’s there, this is not relevant anymore, and this note is rather confusing: it looks like it’s trying to say something important but ends it with “nah, never mind”.

Feel free to send a PR removing this note, there’s no need for it anymore.

@pepelsbey pepelsbey added effort: small This task is a small effort. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Nov 14, 2023
@OnkarRuikar
Copy link
Contributor

OnkarRuikar commented Nov 14, 2023

The note talks about specs but have all the browsers implemented the Level 4 spec?
Do we need to test this on major browsers before removing the note?

@lsc9
Copy link
Author

lsc9 commented Nov 15, 2023

Hey! Thank you for bringing this up :)

To be honest, I can’t even find this limitation mentioned in the Level 3 spec. But even if it’s there, this is not relevant anymore, and this note is rather confusing: it looks like it’s trying to say something important but ends it with “nah, never mind”.

Feel free to send a PR removing this note, there’s no need for it anymore.

If there is no such restriction, you need to delete the note. If there is, there is no need to delete it.

@pepelsbey
Copy link
Member

Do we need to test this on major browsers before removing the note?

html:only-of-type {
  background-color: tomato;
}

This snippet makes <html> tomato in Firefox, Safari, and Chrome, although the root element doesn’t have parents. So I guess it’s supported in all major browsers.

@pepelsbey
Copy link
Member

The only place I could find that mentioned parent for :only-of-type is the 12-year-old version the Level 3 spec.

Represents an element that has a parent element and whose parent element has no other element children with the same expanded element name.

All later versions of the spec don’t mention this limitation. It should be safe to remove, considering everything.

@OnkarRuikar
Copy link
Contributor

We need to update https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs effort: small This task is a small effort.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants