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

Reversed behaviour for the novalidate attribute in the form #274

Open
okoram opened this issue Jul 15, 2024 · 2 comments
Open

Reversed behaviour for the novalidate attribute in the form #274

okoram opened this issue Jul 15, 2024 · 2 comments
Labels

Comments

@okoram
Copy link

okoram commented Jul 15, 2024

BC Break Report

Q A
Version 3.20.0

Summary

There is a problem with the operation of the novalidate attribute after a change:
#273

According to the documentation: https://html.spec.whatwg.org/#attr-fs-novalidate

The novalidate and formnovalidate content attributes are boolean attributes. If present, they indicate that the form is not to be validated during submission.

Therefore, it does not matter what value is assigned to the novalidate attribute. As long as this attribute is present, it is treated as TRUE - the form is not to be validated.

This change has therefore reversed the condition's behavior in all cases except one:
Element::setAttribute('novalidate', true)

In my opinion, this change should be marked as "Breaking Changes".

Previous behavior

novalidate
novalidate=""
novalidate="novalidate"
novalidate="anything"
etc. are always TRUE.

Element::setAttribute('novalidate', 'anything')
rendered as novalidate="anything", which meant TRUE

Current behavior

Element::setAttribute('novalidate', 'anything')
renders nothing, which means FALSE

@okoram
Copy link
Author

okoram commented Jul 15, 2024

I have re-checked all these variants and the problem only occurs in one case:
Element::setAttribute('novalidate', '')

Previous behavior

Element::setAttribute('novalidate', '')
rendered as novalidate="", which meant TRUE

Current behavior

Element::setAttribute('novalidate', '')
renders nothing, which means FALSE

@froschdesign
Copy link
Member

froschdesign commented Jul 22, 2024

In my opinion, this change should be marked as "Breaking Changes".

We follow semantic versioning, so breaking changes are only allowed in a new major version.
The change was made to ensure consistent handling of the boolean attributes.
For example, if you run frontend tests or use the empty string as a value, this can lead to problems. Therefore the question if there was a concrete problem in your application?

Thanks in advance! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants