question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor HTML attribute prefix

See original GitHub issue

Is 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:open
  • Created a year ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SteveSandersonMScommented, Jun 15, 2023

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

1reaction
SteveSandersonMScommented, Jun 15, 2023

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add HTML attributes (class, etc.) to Blazor ...
This seems like a very basic question but I have yet to find the answer I'm looking for. Say you have a Blazor...
Read more >
Code generated HTML attributes
The technique we need to employ to generate one or more attributes + values for a HTML element is called "Attribute splatting". Attribute...
Read more >
ASP.NET Core Blazor attribute splatting and arbitrary ...
This scenario is useful for defining a component that produces a markup element that supports a variety of customizations. For example, it can ......
Read more >
Using HTML attributes and DOM events in the input element
The following is a list of Syncfusion Blazor UI components that use the standard HTML input element. You can apply the HTML input...
Read more >
Arbitrary attributes and parameters in Blazor
In this article we will discuss how a component can accept arbitrary attributes. This is continuation to our previous article Attribute Splatting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found