Skip to content

Data-* attribute throws "Attributes may only be added immediately after frames of type Element or Component" #10897

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
ZergZe opened this issue Jun 5, 2019 · 3 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components investigate

Comments

@ZergZe
Copy link

ZergZe commented Jun 5, 2019

Describe the bug

Getting "InvalidOperationException: Attributes may only be added immediately after frames of type Element or Component" when add data-* attribute together with onclick handler on the same element:

To Reproduce

@page "/counter"

<p>Current count: @currentCount</p>

<button data-test=@("test") onclick="@IncrementCount">Click me</button>

@functions {
int currentCount = 0;

    void IncrementCount()
    {
        currentCount++;
    }
}

Expected behavior

...
<button data-test="test" ...
...

Hope this will help when release, but not sure.

@ZergZe ZergZe changed the title Data-* attribute for TR throwns Exception Data-* attribute throwns "Attributes may only be added immediately after frames of type Element or Component" Jun 5, 2019
@ZergZe ZergZe changed the title Data-* attribute throwns "Attributes may only be added immediately after frames of type Element or Component" Data-* attribute throws "Attributes may only be added immediately after frames of type Element or Component" Jun 5, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Jun 5, 2019
@danroth27 danroth27 added this to the 3.0.0-preview8 milestone Jun 5, 2019
@danroth27
Copy link
Member

@ZergZe Could you please confirm what version of Blazor you are using?

@ZergZe
Copy link
Author

ZergZe commented Jun 6, 2019

@danroth27

Thank you for the response!
I'm using 3.0.100-preview5-011568.
Blazor (server-side).

@ZergZe
Copy link
Author

ZergZe commented Jun 14, 2019

Hi,

I'm happy to say that the issue does not reproduce on the Blazor Preview 6.

Thank you for the fix!

@ZergZe ZergZe closed this as completed Jun 14, 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 investigate
Projects
None yet
Development

No branches or pull requests

4 participants