-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.languageseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
Repro: Create a .razor
file containing:
<button onclick='alert("hello")'>Click me</button>
Compiled result:
__builder.AddMarkupContent(0, "<button onclick=\"alert(\"hello\")\">Click me</button>");
This is incorrect because the double-quotes inside the attribute haven't been encoded in any way. At runtime, clicking on the button will produce an error (SyntaxError: Unexpected end of input
).
Expected result: Something like
__builder.AddMarkupContent(0, "<button onclick=\"alert("hello")\">Click me</button>");
Or even:
__builder.AddMarkupContent(0, "<button onclick='alert(\"hello\")'>Click me</button>");
Do we claim to support single-quoted attributes fully in Razor?
Metadata
Metadata
Assignees
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-razor.languageseverity-nice-to-haveThis label is used by an internal toolThis label is used by an internal tool