LibWeb: Implement HTMLFormElement::checkValidity (constraint validation)

This change implements the requirements from the HTML spec at
https://html.spec.whatwg.org/#statically-validate-the-constraints
and https://html.spec.whatwg.org/#dom-form-checkvalidity — the parts of
the HTML constraint validation API (aka “client-side form validation”)
https://html.spec.whatwg.org/#the-constraint-validation-api for
HTMLFormElement itself — as well as the code for the requirements at
https://html.spec.whatwg.org/#check-validity-steps, which are the shared
requirements for the checkValidity method for individual form controls.
This commit is contained in:
sideshowbarker 2025-02-22 22:14:44 +09:00 committed by Tim Ledbetter
commit 7c34746571
Notes: github-actions[bot] 2025-02-26 04:14:35 +00:00
4 changed files with 62 additions and 2 deletions

View file

@ -78,6 +78,12 @@ public:
GC::Ref<HTMLFormControlsCollection> elements() const;
unsigned length() const;
struct StaticValidationResult {
bool result;
GC::RootVector<GC::Ref<DOM::Element>> unhandled_invalid_controls;
};
StaticValidationResult statically_validate_constraints();
WebIDL::ExceptionOr<bool> check_validity();
WebIDL::ExceptionOr<bool> report_validity();