mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibWeb: Add HTML legend element form getter
This commit is contained in:
parent
fb7b03d162
commit
529fd0a65c
3 changed files with 17 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/HTMLFieldSetElement.h>
|
||||
#include <LibWeb/HTML/HTMLLegendElement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -24,4 +25,17 @@ void HTMLLegendElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLegendElementPrototype>(realm, "HTMLLegendElement"_fly_string));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-legend-form
|
||||
HTMLFormElement* HTMLLegendElement::form()
|
||||
{
|
||||
// The form IDL attribute's behavior depends on whether the legend element is in a fieldset element or not.
|
||||
// If the legend has a fieldset element as its parent, then the form IDL attribute must return the same value as the form IDL attribute on that fieldset element.
|
||||
if (is<HTML::HTMLFieldSetElement>(parent_element())) {
|
||||
return verify_cast<HTML::HTMLFieldSetElement>(parent_element())->form();
|
||||
}
|
||||
|
||||
// Otherwise, it must return null.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue