LibWeb/HTML: Add the commandForElement attribute to the button element

This commit adds the commandForElement attribute to the
button element. Executing commands is not implemented yet.
This commit is contained in:
Glenn Skrzypczak 2025-04-04 01:27:55 +02:00 committed by Tim Ledbetter
commit ffe0b05abd
Notes: github-actions[bot] 2025-04-18 11:11:13 +00:00
6 changed files with 144 additions and 3 deletions

View file

@ -87,6 +87,7 @@ void HTMLButtonElement::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
PopoverInvokerElement::visit_edges(visitor);
visitor.visit(m_command_for_element);
}
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex

View file

@ -81,7 +81,10 @@ public:
virtual void activation_behavior(DOM::Event const&) override;
String command() const;
WebIDL::ExceptionOr<void> set_command(String const& command);
WebIDL::ExceptionOr<void> set_command(String const&);
GC::Ptr<DOM::Element> command_for_element() { return m_command_for_element; }
void set_command_for_element(GC::Ptr<DOM::Element> value) { m_command_for_element = value; }
private:
virtual void visit_edges(Visitor&) override;
@ -92,6 +95,8 @@ private:
// ^DOM::Element
virtual i32 default_tab_index_value() const override;
GC::Ptr<DOM::Element> m_command_for_element;
};
}

View file

@ -16,6 +16,7 @@ interface HTMLButtonElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute DOMString command;
[CEReactions, Reflect=commandfor] attribute Element? commandForElement;
[CEReactions, Reflect] attribute boolean disabled;
readonly attribute HTMLFormElement? form;
[CEReactions] attribute USVString formAction;