mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 01:27:31 +00:00
LibWeb: Add basic support for HTMLInputElement.form
HTMLInputElement now inherits from FormAssociatedElement, which will be a common base for the handful of elements that need to track their owner form (and register with it for the form.elements collection.) At the moment, the owner form is assigned during DOM insertion/removal of an HTMLInputElement. I didn't implement any of the legacy behaviors defined by the HTML parsing spec yet.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -138,4 +138,14 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
||||
set_shadow_root(move(shadow_root));
|
||||
}
|
||||
|
||||
void HTMLInputElement::inserted()
|
||||
{
|
||||
set_form(first_ancestor_of_type<HTMLFormElement>());
|
||||
}
|
||||
|
||||
void HTMLInputElement::removed_from(DOM::Node*)
|
||||
{
|
||||
set_form(nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user