-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Clarify that the universal selector does not match pseudo-elements #41958
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
|
Preview URLs Flaws (2)URL:
(comment last updated: 2025-11-17 17:33:16) |
chrisdavidmills
left a comment
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.
@codersjj You are correct, and I think this is a good addition to the page. However, I feel that your second and last sentences are a bit repetitive. I've provided some suggestions for fixing this problem and making the provided example a bit clearer/more instructive.
Let me know what you think.
files/en-us/web/css/reference/selectors/universal_selectors/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/reference/selectors/universal_selectors/index.md
Outdated
Show resolved
Hide resolved
…dex.md Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
…dex.md Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
@chrisdavidmills LGTM! 👍 |
chrisdavidmills
left a comment
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.
Looking good, thanks @codersjj! Let's get this merged.
Description
Add note clarifying that the universal selector does not match pseudo-elements.
This PR adds a clarification note to the Universal selector (*) documentation to explain that it matches elements only, not pseudo-elements. This helps avoid the common misunderstanding that the universal selector can directly select pseudo-elements.
Motivation
The current MDN page states that:
However:
*::beforewith “universal selector matching pseudo-elements”.*::beforemeans “match all elements, then apply the::beforepseudo-element”.This PR adds a concise NOTE block clarifying this behavior.
Additional details
CSS Selectors Level 4
These specifications collectively establish that pseudo-elements are abstract representations bound to originating elements rather than actual elements in the document tree, therefore the universal selector—which exclusively targets elements—cannot match pseudo-elements directly.
Related issues and pull requests