LibWeb: Implement checkValidity() for HTMLSelectElement

This change adds an implementation of the checkValidity() method for
HTMLSelectElement.
This commit is contained in:
sideshowbarker 2025-02-26 15:44:39 +09:00 committed by Tim Ledbetter
commit db7aa68340
Notes: github-actions[bot] 2025-02-26 14:08:38 +00:00
5 changed files with 18 additions and 10 deletions

View file

@ -702,6 +702,12 @@ bool HTMLSelectElement::will_validate()
return is_candidate_for_constraint_validation(); return is_candidate_for_constraint_validation();
} }
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-checkvalidity
bool HTMLSelectElement::check_validity()
{
return check_validity_steps();
}
bool HTMLSelectElement::is_focusable() const bool HTMLSelectElement::is_focusable() const
{ {
return enabled(); return enabled();

View file

@ -62,6 +62,7 @@ public:
Vector<GC::Root<HTMLOptionElement>> list_of_options() const; Vector<GC::Root<HTMLOptionElement>> list_of_options() const;
bool will_validate(); bool will_validate();
bool check_validity();
// ^EventTarget // ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-select-element // https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-select-element

View file

@ -34,7 +34,7 @@ interface HTMLSelectElement : HTMLElement {
readonly attribute boolean willValidate; readonly attribute boolean willValidate;
readonly attribute ValidityState validity; readonly attribute ValidityState validity;
[FIXME] readonly attribute DOMString validationMessage; [FIXME] readonly attribute DOMString validationMessage;
[FIXME] boolean checkValidity(); boolean checkValidity();
[FIXME] boolean reportValidity(); [FIXME] boolean reportValidity();
undefined setCustomValidity(DOMString error); undefined setCustomValidity(DOMString error);

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 130 tests Found 130 tests
76 Pass 78 Pass
54 Fail 52 Fail
Pass [INPUT in TEXT status] no constraint Pass [INPUT in TEXT status] no constraint
Pass [INPUT in TEXT status] no constraint (in a form) Pass [INPUT in TEXT status] no constraint (in a form)
Pass [INPUT in TEXT status] not suffering from being too long Pass [INPUT in TEXT status] not suffering from being too long
@ -126,9 +126,9 @@ Pass [INPUT in FILE status] no constraint
Pass [INPUT in FILE status] no constraint (in a form) Pass [INPUT in FILE status] no constraint (in a form)
Pass [INPUT in FILE status] suffering from being missing Pass [INPUT in FILE status] suffering from being missing
Pass [INPUT in FILE status] suffering from being missing (in a form) Pass [INPUT in FILE status] suffering from being missing (in a form)
Fail [select] no constraint Pass [select] no constraint
Pass [select] no constraint (in a form) Pass [select] no constraint (in a form)
Fail [select] suffering from being missing Pass [select] suffering from being missing
Pass [select] suffering from being missing (in a form) Pass [select] suffering from being missing (in a form)
Pass [textarea] no constraint Pass [textarea] no constraint
Pass [textarea] no constraint (in a form) Pass [textarea] no constraint (in a form)

View file

@ -2,10 +2,11 @@ Harness status: OK
Found 6 tests Found 6 tests
6 Fail 4 Pass
Fail Placeholder label options within a select 2 Fail
Fail Placeholder label-like options within optgroup Pass Placeholder label options within a select
Pass Placeholder label-like options within optgroup
Fail Validation on selects with display size set as more than one Fail Validation on selects with display size set as more than one
Fail Validation on selects with multiple set Fail Validation on selects with multiple set
Fail Validation on selects with non-empty disabled option Pass Validation on selects with non-empty disabled option
Fail Remove and add back the placeholder label option Pass Remove and add back the placeholder label option