LibWeb: Implement validity IDL attribute

This commit is contained in:
Psychpsyo 2025-02-17 20:44:26 +01:00 committed by Tim Ledbetter
commit 83c4e22247
Notes: github-actions[bot] 2025-02-18 06:38:10 +00:00
33 changed files with 2007 additions and 31 deletions

View file

@ -23,6 +23,7 @@
#include <LibWeb/HTML/HTMLSelectElement.h>
#include <LibWeb/HTML/HTMLTextAreaElement.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/ValidityState.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Selection/Selection.h>
@ -48,6 +49,13 @@ void FormAssociatedElement::set_form(HTMLFormElement* form)
m_form->add_associated_element({}, form_associated_element_to_html_element());
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validity
GC::Ref<ValidityState const> FormAssociatedElement::validity() const
{
auto& realm = form_associated_element_to_html_element().realm();
return realm.create<ValidityState>(realm, *this);
}
bool FormAssociatedElement::enabled() const
{
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-disabled