Skip to content

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

Closed

Description

@ZergZe

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.

Activity

  1. 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"[/+] on Jun 5, 2019
  2. 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"[/+] on Jun 5, 2019
  3. added this to the 3.0.0-preview8 milestone on Jun 5, 2019
  4. danroth27 commented on Jun 5, 2019

    @danroth27
    Member

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

  5. ZergZe commented on Jun 6, 2019

    @ZergZe
    Author

    @danroth27

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

  6. ZergZe commented on Jun 14, 2019

    @ZergZe
    Author

    Hi,

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

    Thank you for the fix!

  7. ghost locked as resolved and limited conversation to collaborators on Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions