Skip to content
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

Button elements render with a value attribute even when the value is null or undefined #5197

Closed
svensigmond opened this issue Jul 24, 2020 · 2 comments
Labels
bug compiler Changes relating to the compiler temp-stale

Comments

@svensigmond
Copy link

Describe the bug
The conditional attribute functionality seems to be broken for buttons when it comes to the value attribute.

Button elements render with a value attribute even if the value is null or undefined.

To Reproduce
Please consider the following example:
https://svelte.dev/repl/dc5009fbb5a242b583de400e0df3c99b?version=3.24.0

Please inspect the first button and notice that it contains a value attribute and the attribute is set to null

Expected behavior
The button should not have a value attribute because its value is null. The same should go for undefined.

This does not match the conditional functionality as explained by Conduitry in the following comment:
#259 (comment)

Information about your Svelte project:

  • Svelte version (3.24.0 REPL)

Severity
Annoying

Additional context
It is my understanding that the conditional behaviour only applies to valid html element attributes. Value is a valid attribute, so I suspect this is a simple oversight:

https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element

@mindrones
Copy link
Member

Seems related to #4467

@dummdidumm
Copy link
Member

dummdidumm commented Jul 12, 2021

Closing as duplicate of #4467 , which also notes the inconsistencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug compiler Changes relating to the compiler temp-stale
Projects
None yet
Development

No branches or pull requests

4 participants