Skip to content

Unable to unset a 'form' prop on a button with null value. #2840

@LinusBorg

Description

@LinusBorg

Version

3.0.4

Reproduction link

https://jsfiddle.net/Linusborg/2fwLmu5b/

Steps to reproduce

  • Run the fiddle above.
  • check the console
  • See an error:

What is expected?

'form' attribute is being unset successfully.

What is actually happening?

Console Warning:

Failed setting prop "form" on : value null is invalid. TypeError: Cannot set property form of # which has only a getter


#1788 attempted to solve a similar problem, making Vue patch this with setAttribute instead of setting it as a DOMprop - but the added value check makes Vue fall back to a DOMprop assignment for non-string values.

Note also that setting it as an empty string is not a proper solution as this breaks the button's form property's inheritance of the form's ID it might be nested within.

So we need to use setAttribute() regardless of the type of value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions