mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:37:34 +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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ class HTMLLegendElement final : public HTMLElement {
|
|||
public:
|
||||
virtual ~HTMLLegendElement() override;
|
||||
|
||||
HTMLFormElement* form();
|
||||
|
||||
private:
|
||||
HTMLLegendElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
interface HTMLLegendElement : HTMLElement {
|
||||
[HTMLConstructor] constructor();
|
||||
|
||||
// FIXME: readonly attribute HTMLFormElement? form;
|
||||
readonly attribute HTMLFormElement? form;
|
||||
|
||||
// Obsolete
|
||||
[CEReactions, Reflect] attribute DOMString align;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue