mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:24:58 +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:
parent
00d8e3b02b
commit
b092353e4d
8 changed files with 110 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue