Skip to content

Commit c2fb8ff

Browse files
authored
Fix the valueMissing check for <input type=radio>
1 parent 574eb51 commit c2fb8ff

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lib/jsdom/living/nodes/HTMLInputElement-impl.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ class HTMLInputElementImpl extends HTMLElementImpl {
332332
return null;
333333
}
334334

335-
_isRadioGroupChecked() {
336-
if (this.checked) {
335+
_someInRadioGroup(name) {
336+
if (this[name]) {
337337
return true;
338338
}
339-
return this._otherRadioGroupElements.some(radioGroupElement => radioGroupElement.checked);
339+
return this._otherRadioGroupElements.some(radioGroupElement => radioGroupElement[name]);
340340
}
341341

342342
get _mutable() {
@@ -976,7 +976,7 @@ class HTMLInputElementImpl extends HTMLElementImpl {
976976
// and all of the input elements in the radio button group have a checkedness
977977
// that is false, then the element is suffering from being missing.
978978
case "radio":
979-
if (this._required && !this._isRadioGroupChecked()) {
979+
if (this._someInRadioGroup("_required") && !this._someInRadioGroup("checked")) {
980980
return true;
981981
}
982982
break;

test/web-platform-tests/to-run.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ DIR: html/semantics/forms/constraints
656656

657657
form-validation-validity-valueMissing.html: [fail, 'Spec unclear (see https://github.com/whatwg/html/issues/5202)']
658658
infinite_backtracking.html: [timeout, We cannot restrict duration of regex matching from JavaScript]
659-
radio-valueMissing.html: [fail, fix https://github.com/zjffun/jsdom/commits/fix/radio-value-missing]
660659

661660
---
662661

0 commit comments

Comments
 (0)