LibWeb: Add stub for ValidityState

This fixes https://html5test.com/ as previously an exception was being
thrown after trying to access this attribute which would then result in
a popup about the test failing (and none of the test results being
shown).
This commit is contained in:
Shannon Booth
2024-06-09 15:13:38 +12:00
committed by Andreas Kling
parent 0ec0e92b10
commit e0bbbc729b
9 changed files with 87 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include <LibWeb/HTML/HTMLDivElement.h>
#include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/ValidityState.h>
#include <LibWeb/HTML/Numbers.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Scripting/Environments.h>
@@ -82,6 +83,17 @@ void HTMLInputElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_image_request);
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-validity
JS::NonnullGCPtr<ValidityState const> HTMLInputElement::validity() const
{
auto& vm = this->vm();
auto& realm = this->realm();
dbgln("FIXME: Implement validity attribute getter");
return vm.heap().allocate<ValidityState>(realm, realm);
}
JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
if (type_state() == TypeAttributeState::Hidden)