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

[selectors] :first-node/:last-node/:only-node pseudo-classes #11154

Closed
LeaVerou opened this issue Nov 5, 2024 · 2 comments
Closed

[selectors] :first-node/:last-node/:only-node pseudo-classes #11154

LeaVerou opened this issue Nov 5, 2024 · 2 comments

Comments

@LeaVerou
Copy link
Member

LeaVerou commented Nov 5, 2024

Currently, :*-child pseudo-classes only consider element children, and will match even if the element has text nodes before it. For example, in <button>foo <i>A</i> bar</button> :first-child, :last-child and :only-child will all match. For many use cases, it is important to match when the node is actually the first/last/only one.

I have not found use cases requiring :nth-node(), so I think the three titular pseudos should do it.

@Loirooriol
Copy link
Contributor

See #3216

@LeaVerou
Copy link
Member Author

LeaVerou commented Nov 5, 2024

Thanks! Closing this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants