mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:47:43 +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/Bindings/Intrinsics.h>
|
||||||
|
#include <LibWeb/HTML/HTMLFieldSetElement.h>
|
||||||
#include <LibWeb/HTML/HTMLLegendElement.h>
|
#include <LibWeb/HTML/HTMLLegendElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
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));
|
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:
|
public:
|
||||||
virtual ~HTMLLegendElement() override;
|
virtual ~HTMLLegendElement() override;
|
||||||
|
|
||||||
|
HTMLFormElement* form();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLLegendElement(DOM::Document&, DOM::QualifiedName);
|
HTMLLegendElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
interface HTMLLegendElement : HTMLElement {
|
interface HTMLLegendElement : HTMLElement {
|
||||||
[HTMLConstructor] constructor();
|
[HTMLConstructor] constructor();
|
||||||
|
|
||||||
// FIXME: readonly attribute HTMLFormElement? form;
|
readonly attribute HTMLFormElement? form;
|
||||||
|
|
||||||
// Obsolete
|
// Obsolete
|
||||||
[CEReactions, Reflect] attribute DOMString align;
|
[CEReactions, Reflect] attribute DOMString align;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue