Repository navigation
Parse user-action pseudo-classes after pseudo-elements - #224
Closed
Aschenbath wants to merge 1 commit into
Closed
Aschenbath wants to merge 1 commit into
Aschenbath wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.something::before:hoveris valid Selectors Level 4 syntax, but parsing it currently raisesSelectorSyntaxError. Support user-action pseudo-classes after pseudo-elements, keeping their state separate from the originating element so canonical output and specificity preserve the difference between::before:hoverand:hover::before.Fixes #144.
The parser accepts
:hover,:active,:focus,:focus-visibleand:focus-within, plus their:is(),:where()and:not()combinations within the existing limits of those functions. The same restrictions apply inside their arguments. Classes, IDs, attributes, explicit type/universal selectors, combinators and further pseudo-elements remain rejected in this position. Pseudo-element-specific additional states are outside this change.Newly accepted selectors expose a
QualifiedPseudoElementwith the original pseudo-element and a separate state tree. Previously accepted selectors keep their existing string orFunctionalPseudoElementrepresentation. Default XPath translation still rejects pseudo-elements;selector_to_xpathwith its default options ignores the entire qualified pseudo-element. Custom translators receive the wrapper and can explicitly handle or reject its state.Validation on Linux, CPython 3.12.12:
An independent Codex reviewer also passed 5,591 assertions against source and the installed wheel, checking real XPath results against a separate Boolean oracle and confirming pseudo-element state stays separate from host state.
Other Python versions and platforms were not run locally. OpenAI Codex implemented and tested this change; a separate Codex agent reviewed it. No human review is claimed.