Bug 1569314 - Remove IsOptionDisabled check and add relevant test case. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D108005
This commit is contained in:
Loek 2021-03-14 01:07:31 +00:00
parent 8165271661
commit ab2f5aa66a
2 changed files with 12 additions and 4 deletions

View File

@ -1495,10 +1495,6 @@ bool HTMLSelectElement::IsValueMissing() const {
continue;
}
if (IsOptionDisabled(option)) {
continue;
}
return false;
}

View File

@ -92,4 +92,16 @@ test(function() {
select.appendChild(optgroup);
assert_true(select.checkValidity(), "If one option within an optgroup or not is selected, the select should be considered valid.");
}, "Validation on selects with multiple set");
test(function() {
var select = document.createElement('select');
select.required = true;
var option = document.createElement('option');
option.value = 'test';
option.disabled = true;
option.selected = true;
select.appendChild(option);
assert_true(select.checkValidity(), "When a required select has an option that is selected and disabled, the select should be considered valid.");
}, "Validation on selects with non-empty disabled option");
</script>