Bug 1621273 - Value attribute changes can affect step validity even if the input value doesn't change. r=smaug

If the actual input value didn't change, we'd skip updating form validity, but
that's not always correct because GetStepBase() depends on the value attribute.

Differential Revision: https://phabricator.services.mozilla.com/D66836
This commit is contained in:
Emilio Cobos Álvarez
2020-03-13 21:59:27 +00:00
parent cc56d83b77
commit 26fe428642
2 changed files with 25 additions and 3 deletions

View File

@@ -1193,9 +1193,13 @@ nsresult HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
// of the element so, if the value of the element is different than @value,
// we have to re-set it. This is only the case when GetValueMode() returns
// VALUE_MODE_VALUE.
if (aName == nsGkAtoms::value && !mValueChanged &&
GetValueMode() == VALUE_MODE_VALUE) {
SetDefaultValueAsValue();
if (aName == nsGkAtoms::value) {
if (!mValueChanged && GetValueMode() == VALUE_MODE_VALUE) {
SetDefaultValueAsValue();
}
// GetStepBase() depends on the `value` attribute if `min` is not present,
// even if the value doesn't change.
UpdateStepMismatchValidityState();
}
//