dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.5k stars 10.04k forks source link

Blazor HTML attribute prefix #40997

Open acordts opened 2 years ago

acordts commented 2 years ago

Is there an existing issue for this?

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]

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

krompaco commented 1 year ago

This disrespect to web standards is a bit worrying. Hopefully fixed soon! Probably more will notice when Blazor SSR starts to spread.

SteveSandersonMS commented 1 year ago

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).

krompaco commented 1 year ago

Thanks @SteveSandersonMS - great that it won't be an issue with SSR.

However, it's quite common in QA to also use for example Chromium, load a web page and pull the HTML from the current DOM. Then validate that version as well as the SSR version. So good to be standards compliant at that stage as well.

SteveSandersonMS commented 1 year ago

Thanks for the extra info. It's definitely something we can keep an eye on, in case it becomes a more common issue.