Repository navigation
Core: Avoid unused regex engine in trimmed WASM apps - #14208
Merged
Merged
Conversation
Built-in mask characters and MudBlazor's own key bindings no longer go through Regex. A trimmed WebAssembly app with a text field, select or data grid drops about 86-88 KB (brotli) of System.Text.RegularExpressions. - MaskChar.Letter, Digit and LetterOrDigit test the character with char.IsLetter, char.IsDigit and char.IsLetterOrDigit. Custom mask characters from the public constructor still match through their expression. - Components register keys through new internal literal and predicate methods on KeyMapBuilder. The public string methods keep their "/pattern/" support. - The "/./" and "/^[^ ]$/" bindings in the dialog and select become predicates that match the same keys.
…hout an expression
There was a problem hiding this comment.
Moving the built-in mask characters and MudBlazor's own key registrations off the regex engine keeps behavior the same, and all string-based key registrations in the library have been converted. The new tests cover equivalence, case sensitivity and first-match ordering. I found nothing that needs fixing before merge.
The literal registrations went through a predicate command, which cost a closure and two delegates per key. Every checkbox, switch, radio, chip and list item registers several keys, so that added up per instance. A dedicated command holds the key or key set and the action directly.
This was referenced Nov 16, 2026
This was referenced Nov 17, 2026
N3rdage
pushed a commit
to N3rdage/the-library
that referenced
this pull request
Nov 20, 2026
Updated [MudBlazor](https://github.com/MudBlazor/MudBlazor) from 9.13.0 to 9.14.0. <details> <summary>Release notes</summary> _Sourced from [MudBlazor's releases](https://github.com/MudBlazor/MudBlazor/releases)._ ## 9.14.0 > [!NOTE] > MudBlazor now targets `net11.0` alongside .NET 8, 9 and 10. <!-- Release notes generated using configuration in .github/release.yml at dev --> ## What's Changed ### New Features * MudDataGrid: Expose filter operator lookup by data type by @xiaoyao-666-coder in MudBlazor/MudBlazor#14144 * Core: Add .NET 11 target by @danielchalmers in MudBlazor/MudBlazor#14170 * MudVirtualize: Add ItemComparer on .NET 11 by @danielchalmers in MudBlazor/MudBlazor#14191 * MudNavLink: Add RelativeToCurrentUri on .NET 11 by @danielchalmers in MudBlazor/MudBlazor#14192 * MudDrawer: Add OnBreakpointChanged event by @versile2 in MudBlazor/MudBlazor#13021 * MudDataGrid: Add bindable column order state and order event by @versile2 in MudBlazor/MudBlazor#12827 * MudFileUpload: Add folder upload support and relative path tracking by @drewe7192 in MudBlazor/MudBlazor#13854 * MudNavigationBar: New component by @mckaragoz in MudBlazor/MudBlazor#11318 ### Bug Fixes * MudDialog: Fix close button positioned outside dialog by @danielchalmers in MudBlazor/MudBlazor#14206 * Converters: Fix TimeOnly fields rejecting input without a Format by @danielchalmers in MudBlazor/MudBlazor#14210 * MudDialog: Fix inline dialog ignoring OnKeyDown and OnKeyUp by @danielchalmers in MudBlazor/MudBlazor#14211 * MudDataGrid: Keep rows when a Guid filter has no value by @b84330808 in MudBlazor/MudBlazor#14135 * MudForm: Invoke OnEnterPressed after inputs commit their value by @BurakErdemci in MudBlazor/MudBlazor#13840 * MudSplitPanel: Apply divider calls made before panel is ready by @danielchalmers in MudBlazor/MudBlazor#14228 * MudFileUpload: Keep selected files when appending too many by @danielchalmers in MudBlazor/MudBlazor#14229 * MudFileUpload: Clear errors from previous selection by @danielchalmers in MudBlazor/MudBlazor#14230 * MudTable: Keep MultiSelection checkbox in place on small screens by @danielchalmers in MudBlazor/MudBlazor#14233 * Charts: Remeasure axis labels for charts hidden at first render by @danielchalmers in MudBlazor/MudBlazor#14234 * Core: Revert recognising parent height set in stylesheet by @danielchalmers in MudBlazor/MudBlazor#14238 * MudMask: Fix focus loop in Blazor Hybrid after host window loses focus by @Primeteumm in MudBlazor/MudBlazor#14237 * MudDataGrid: Cancel form edits closed by backdrop click or Escape by @danielchalmers in MudBlazor/MudBlazor#14242 * MudTimePicker: Fix JS error when clock opens and closes in one render by @danielchalmers in MudBlazor/MudBlazor#14243 ### Accessibility * MudDataGrid: Show header controls on keyboard focus by @DevonEast in MudBlazor/MudBlazor#13899 * MudColorPicker: Add accessible names to channel inputs by @danielchalmers in MudBlazor/MudBlazor#14226 * MudList: Use tree roles for nested lists by @danielchalmers in MudBlazor/MudBlazor#14231 ### Performance * MudDataGrid: Stop tracking Items collection no longer in use by @danielchalmers in MudBlazor/MudBlazor#14207 * Core: Avoid unused regex engine in trimmed WASM apps by @danielchalmers in MudBlazor/MudBlazor#14208 ## New Contributors * @xiaoyao-666-coder made their first contribution in MudBlazor/MudBlazor#14144 * @b84330808 made their first contribution in MudBlazor/MudBlazor#14135 * @DevonEast made their first contribution in MudBlazor/MudBlazor#13899 * @BurakErdemci made their first contribution in MudBlazor/MudBlazor#13840 * @drewe7192 made their first contribution in MudBlazor/MudBlazor#13854 * @Primeteumm made their first contribution in MudBlazor/MudBlazor#14237 **Full Changelog**: MudBlazor/MudBlazor@v9.13.0...v9.14.0 Commits viewable in [compare view](MudBlazor/MudBlazor@v9.13.0...v9.14.0). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced Nov 20, 2026
Closed
Merged
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.
A trimmed Blazor WebAssembly app with a MudTextField, MudSelect or MudDataGrid downloads the whole regex parser and interpreter, even when it never uses a regular expression.
Two places kept it reachable:
Regex.IsMatchon every typed character, and every text field can take a mask."/pattern/"keys.Now
MaskChar.Letter,DigitandLetterOrDigittest the character directly, and MudBlazor's components register keys through internal methods that never build a Regex.No public API changes.
RegexMask, BlockMask, MultiMask, MudHighlighter, a custom MaskChar and
"/pattern/"keys still use the engine, as before.Download size
Release publish of the
blazorwasmtemplate with default trimming,_frameworktotal, brotli.System.Text.RegularExpressions.wasm drops from about 240 KB to 22.8 KB raw; the rest serves source-generated regexes.
Pages with DateMask, the date, time and color pickers, MudAutocomplete, MudMenu, MudTabs, MudTable and MudNumericField end at the same 22.8 KB.
Behavior
DispatchAsyncby hand no longer throws in a dialog or select, and a key containing a line feed no longer matches.