LibWeb/HTML: Make command events not composed

Also re-import the affected button-event-dispatch test.

Corresponds to:
787316d519
This commit is contained in:
Sam Atkins 2025-11-27 12:55:21 +00:00
parent d2b261d28e
commit ed5169af8d
Notes: github-actions[bot] 2025-12-01 11:09:26 +00:00
2 changed files with 6 additions and 7 deletions

View file

@ -225,7 +225,7 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
// 5. Let continue be the result of firing an event named command at target, using CommandEvent, with its
// command attribute initialized to command, its source attribute initialized to element, and its cancelable
// and composed attributes initialized to true.
// attribute initialized to true.
// NOTE: DOM standard issue #1328 tracks how to better standardize associated event data in a way which makes
// sense on Events. Currently an event attribute initialized to a value cannot also have a getter, and so
// an internal slot (or map of additional fields) is required to properly specify this.
@ -233,7 +233,6 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
event_init.command = command;
event_init.source = this;
event_init.cancelable = true;
event_init.composed = true;
auto event = CommandEvent::create(realm(), HTML::EventNames::command, move(event_init));
event->set_is_trusted(true);

View file

@ -30,7 +30,7 @@
assert_true(event instanceof CommandEvent, "event is CommandEvent");
assert_equals(event.type, "command", "type");
assert_equals(event.bubbles, false, "bubbles");
assert_equals(event.composed, true, "composed");
assert_equals(event.composed, false, "composed");
assert_equals(event.isTrusted, true, "isTrusted");
assert_equals(event.command, "--custom-command", "command");
assert_equals(event.target, invokee, "target");
@ -47,7 +47,7 @@
assert_true(event instanceof CommandEvent, "event is CommandEvent");
assert_equals(event.type, "command", "type");
assert_equals(event.bubbles, false, "bubbles");
assert_equals(event.composed, true, "composed");
assert_equals(event.composed, false, "composed");
assert_equals(event.isTrusted, true, "isTrusted");
assert_equals(event.command, "--custom-command", "command");
assert_equals(event.target, invokee, "target");
@ -66,7 +66,7 @@
assert_true(event instanceof CommandEvent, "event is CommandEvent");
assert_equals(event.type, "command", "type");
assert_equals(event.bubbles, false, "bubbles");
assert_equals(event.composed, true, "composed");
assert_equals(event.composed, false, "composed");
assert_equals(event.isTrusted, true, "isTrusted");
assert_equals(event.command, command, "command");
assert_equals(event.target, invokee, "target");
@ -82,7 +82,7 @@
assert_true(event instanceof CommandEvent, "event is CommandEvent");
assert_equals(event.type, "command", "type");
assert_equals(event.bubbles, false, "bubbles");
assert_equals(event.composed, true, "composed");
assert_equals(event.composed, false, "composed");
assert_equals(event.isTrusted, true, "isTrusted");
assert_equals(event.command, command, "command");
assert_equals(event.target, invokee, "target");
@ -178,7 +178,7 @@
assert_true(event instanceof CommandEvent, "event is CommandEvent");
assert_equals(event.type, "command", "type");
assert_equals(event.bubbles, false, "bubbles");
assert_equals(event.composed, true, "composed");
assert_equals(event.composed, false, "composed");
assert_equals(event.isTrusted, true, "isTrusted");
assert_equals(event.command, "--custom-command", "command");
assert_equals(event.target, invokee, "target");