Repository navigation
Accept only ASCII digits in :nth-*() series - #205
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #205 +/- ##
=======================================
Coverage 99.79% 99.79%
=======================================
Files 3 3
Lines 987 992 +5
Branches 162 163 +1
=======================================
+ Hits 985 990 +5
Misses 1 1
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
AdrianAtZyte
approved these changes
Oct 19, 2026
wRAR
approved these changes
Oct 19, 2026
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.
:nth-*()series accept non-ASCII digits and digit separatorsparse_series()converts the a and b parts of an An+B argument with Python'sint(), which also accepts any Unicode decimal digit and_separators. Non-ASCII characters tokenize as an IDENT, so they reachparse_series()and get turned into a position:The An+B microsyntax (CSS Syntax §6) is built from number and ident tokens with ASCII digits only, so browsers reject these selectors as invalid instead of matching the 3rd or 10th child. Anything that validates a selector with a browser or another CSS parser and then runs it through cssselect (or the other way round) sees two different meanings for the same string. The integer parts are now checked against
[+-]?[0-9]+beforeint(), so these raiseExpressionErrorlike other invalid series; ASCII input is unaffected and the existing tests pass unchanged. Regression assertions are added totest_series.