Repository navigation
Use ordinal comparisons for pseudoclass checks and IterationCount.Parse - #22604
Merged
MrJul merged 4 commits intoOct 27, 2026
Merged
Conversation
…t checks Culture-sensitive comparisons ignore a soft hyphen (U+00AD), so a class that starts with one followed by ':' is treated as a pseudoclass, and "Infinite" followed by one still parses as Infinite.
…t.Parse These checks test syntax, so a culture-sensitive comparison gives wrong answers for ignorable characters and opens an ICU collator on the UI thread at startup.
maxkatz6
previously approved these changes
Oct 26, 2026
Member
|
@cla-avalonia comment |
Collaborator
|
Contributor
Author
|
@cla-avalonia agree |
NuGet packagesThe packages for this pull request have been published (workflow run):
|
robloo
reviewed
Oct 26, 2026
The char overload was already ordinal, but no test covers this check, so say so explicitly, as the EndsWith check above it does.
MrJul
approved these changes
Oct 26, 2026
MrJul
enabled auto-merge
October 26, 2026 12:39
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 27, 2026
MrJul
pushed a commit
that referenced
this pull request
Nov 2, 2026
…se (#22604) * test: add failing tests for culture-sensitive class and IterationCount checks Culture-sensitive comparisons ignore a soft hyphen (U+00AD), so a class that starts with one followed by ':' is treated as a pseudoclass, and "Infinite" followed by one still parses as Infinite. * fix: use ordinal comparisons for pseudoclass checks and IterationCount.Parse These checks test syntax, so a culture-sensitive comparison gives wrong answers for ignorable characters and opens an ICU collator on the UI thread at startup. * refactor: spell out the ordinal comparison in IterationCount.Parse The char overload was already ordinal, but no test covers this check, so say so explicitly, as the EndsWith check above it does.
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.
What does the pull request do?
Classes,TypeNameAndClassSelectorandIterationCount.Parsechecked for:,-andINFINITEwith culture-sensitiveStartsWith/EndsWith. These are syntax checks, so they're now ordinal. Under a non-English culture, these calls open an ICU collator on the UI thread at startup, as #22582 describes.What is the current behavior?
Culture-sensitive comparisons ignore characters such as the soft hyphen (U+00AD). With a soft hyphen before the colon,
Classes.Addrejects a class as a pseudoclass,Clear()andReplace()keep it, and the selector string leaves out its..IterationCount.Parsealso acceptsInfinitefollowed by a soft hyphen.How was the solution implemented (if it's not obvious)?
Besides the two methods named in the issue, I changed the other
StartsWith(":")checks inClasses.Clear,Classes.ReplaceandTypeNameAndClassSelector, so a class thatAddaccepts isn't treated as a pseudoclass elsewhere.The tests use the soft hyphen to catch a culture-sensitive comparison. They're in the first commit and fail without the second.
StartsWith('-')inIterationCount.Parsehas no test: the only visible difference is which exception is thrown when a soft hyphen comes before the minus sign.Fixed issues
Fixes #22582