Update FieldIdGenerator to support HTML5 instead of HTML 4.01#65058
Merged
ilonatommy merged 7 commits intomainfrom Jan 20, 2026
Merged
Update FieldIdGenerator to support HTML5 instead of HTML 4.01#65058ilonatommy merged 7 commits intomainfrom
ilonatommy merged 7 commits intomainfrom
Conversation
- Remove HTML 4.01 first-character-must-be-letter rule - Simplify to only replace whitespace and periods with underscores - Update documentation to reference HTML5 instead of HTML 4.01 - Remove redundant SearchValues and helper methods - Update tests to reflect HTML5 behavior (no prepending 'z', brackets allowed) - Remove "Arrange Act Assert" comments from all unit tests Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
- Use IndexOfAny for more efficient fast-path check - Add test for various whitespace characters (tab, newline, carriage return) Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update FieldIdGenerator to support HTML5
Update FieldIdGenerator to support HTML5 instead of HTML 4.01
Jan 14, 2026
ilonatommy
reviewed
Jan 14, 2026
- Combine whitespace tests into one - Remove redundant Fact tests (already covered by Theory test) - Remove duplicate InlineData entries Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
ilonatommy
reviewed
Jan 14, 2026
- Convert standalone Fact test to InlineData in Theory test - Further streamlines test structure Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
ilonatommy
approved these changes
Jan 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates FieldIdGenerator to support HTML5 ID attribute rules instead of HTML 4.01, simplifying the validation logic and reducing code complexity.
Changes:
- Removed HTML 4.01 restrictions (first character must be a letter) to allow any non-whitespace characters
- Simplified character validation to only replace whitespace and periods with underscores
- Consolidated test cases into a single Theory test method with InlineData attributes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Components/Web/src/Forms/FieldIdGenerator.cs | Updated to HTML5 rules: removed first-character validation, simplified character replacement logic, removed SearchValues dependency |
| src/Components/Web/test/Forms/FieldIdGeneratorTest.cs | Consolidated tests into single Theory method, removed AAA comments, updated test cases to reflect HTML5 behavior |
- Add SearchValues with all Unicode whitespace characters and period - Ensures fast path catches all whitespace cases consistently - Add test for non-breaking space (U+00A0) Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
auto-merge was automatically disabled
January 15, 2026 09:25
Head branch was pushed to by a user without write access
- Use InvalidIdChars.Contains() in slow path for consistency - Ensures both paths validate the same set of characters Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com>
javiercn
approved these changes
Jan 20, 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.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.