Blazor HTML attribute prefix
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
the NU HTML Checker (https://validator.w3.org) mark syntax errors on html attributes rendered by blazor framework with prefix “bl”
e.g.
Error: Attr i _bl_7209af49-b4f6-4891-96ba-d21c353e56de not allowed on element i at this point.
<i class="rzi d-inline-flex justify-content-center align-items-center" id="3Ki1DEtSSk" _bl_7209af49-b4f6-4891-96ba-d21c353e56de="">
Attributes for element i:
[Global attributes](https://html.spec.whatwg.org/multipage/#global-attributes)
Expected Behavior
Code/ HTML generated by blazor does not raise errors on NU HTML Checker (https://validator.w3.org) validation because of invalid HTML attributes.
The issue / syntax seems correct if the prefix “data-” will be used. e.g. “data-bl …”, “data-bl_”
it seems the prefix will be added in https://github.com/dotnet/aspnetcore/blob/b6630137b2109042dc11ece3164782e451647bff/src/Components/Web.JS/src/Rendering/ElementReferenceCapture.ts#L15
possibly using data- as additional prefix will solve the issue.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.200
Anything else?
Host (useful for support): Version: 6.0.2 Commit: 839cdfb0ec
.NET SDKs installed: 3.1.101 [C:\Program Files\dotnet\sdk] 6.0.200 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks for the extra info. It’s definitely something we can keep an eye on, in case it becomes a more common issue.
The
_bl_*
attributes are added by client-side JS code for interactively-rendered elements that have a@ref
. The attributes are not present in the initial HTML.As such, if you only use SSR, you will not see these attributes at all (since SSR-only elements are not interactively-rendered).