Skip to content

[css-pseudo-4] Add a note explaining Element.pseudo() behaviour #12159 #12406

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[css-pseudo-4] Add a note explaining Element.pseudo() behaviour #12159
As per resolution in #12159, Element.pseudo() returns CSSPseudoElement
even when invoked on Element that can't generate the requested type.
  • Loading branch information
danielsakhapov committed Jun 27, 2025
commit 95720cc46ae3fe23789b8669f97a9ffe32439bbc
6 changes: 6 additions & 0 deletions css-pseudo-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,12 @@ Additions to the CSS Object Model</h2>
(The UA may drop or regenerate the object for convenience or performance
if this is not observable.)

Note: {{CSSPseudoElement}} is returned even when this method is invoked on elements
that can't have the requested pseudo type (e.g. ''::before'' on <{input}>).
See <a href="https://github.com/w3c/csswg-drafts/issues/12159#issuecomment-3005238286">resolution</a> for more details.
Discussion in <a href="https://github.com/w3c/csswg-drafts/issues/12158">Issue 12158</a> will clarify how to
determine that the requested pseudo doesn't really "exist".

ISSUE: The identity, lifetime, and nullness of the return value
(and potential error cases)
of the {{pseudo()}} method is still under discussion.
Expand Down