LibWeb: Associate form elements with a form in parsing and dynamically

This makes it available for all form associated elements and not just
select and input elements. It also makes it more spec compliant,
especially around the form attribute.

The main thing missing is re-associating form elements with a form
attribute when the form attribute changes or an element with an ID
is inserted/removed or has its ID changed.
This commit is contained in:
Luke Wilde 2022-03-01 21:10:48 +00:00 committed by Andreas Kling
parent 29f9947ff9
commit 46c0d0f7ae
Notes: sideshowbarker 2024-07-17 18:04:56 +09:00
9 changed files with 140 additions and 40 deletions

View file

@ -191,18 +191,6 @@ bool HTMLInputElement::is_focusable() const
return m_text_node;
}
void HTMLInputElement::inserted()
{
HTMLElement::inserted();
set_form(first_ancestor_of_type<HTMLFormElement>());
}
void HTMLInputElement::removed_from(DOM::Node* old_parent)
{
HTMLElement::removed_from(old_parent);
set_form(nullptr);
}
void HTMLInputElement::parse_attribute(FlyString const& name, String const& value)
{
FormAssociatedElement::parse_attribute(name, value);