Skip to content

Clean up which directive attributes expect HTML vs C# #10909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danroth27 opened this issue Jun 5, 2019 · 6 comments · Fixed by dotnet/razor#658
Closed

Clean up which directive attributes expect HTML vs C# #10909

danroth27 opened this issue Jun 5, 2019 · 6 comments · Fixed by dotnet/razor#658
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@danroth27
Copy link
Member

danroth27 commented Jun 5, 2019

Currently you need to specify a leading @ character for event handler values. For example:

<button @onclick="@IncrementCount">Count</button>

However, the leading @ character in the attribute value should not be required:

<button @onclick="IncrementCount">Count</button>

See the design notes in #6364

@danroth27
Copy link
Member Author

@NTaylorMullen

@danroth27 danroth27 added area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. labels Jun 5, 2019
@danroth27 danroth27 added this to the 3.0.0-preview7 milestone Jun 5, 2019
@danroth27
Copy link
Member Author

@rynowak It looks like this was the intended design for event handlers and bind, but what about directive attributes like @key and @bind:format?

@ajaybhargavb
Copy link
Contributor

ajaybhargavb commented Jun 5, 2019

As of now,

  • @ref, @bind, @bind-* etc all expect CSharp
  • @bind:event, @bind:format, @key, and @onclick(and friends) all expect HTML

I understand we should fix @onclick to expect CSharp. Should anything else be different in the above list?

@danroth27 danroth27 changed the title Directive attribute values should not require a leading @ Event handler values should not require a leading @ Jun 5, 2019
@NTaylorMullen
Copy link

Ehhh, I thought in Blazor this was all intentional. @rynowak / @SteveSandersonMS would know better though.

@rynowak
Copy link
Member

rynowak commented Jun 5, 2019

I would expect bind:event and bind:format to expect HTML.

Key I'm not sure.

Others should be C#.

@ajaybhargavb
Copy link
Contributor

I edited the list. I meant to put bind:event along with bind:format.

@danroth27 danroth27 changed the title Event handler values should not require a leading @ Clean up which directive attributes expect HTML vs C# Jun 6, 2019
@ajaybhargavb ajaybhargavb added Done This issue has been fixed and removed Working labels Jun 21, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants