mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 06:09:08 +00:00
LibWeb: Update button/input activation behaviour to match spec
This commit is contained in:
parent
ddb832afdf
commit
591c6b0f68
Notes:
github-actions[bot]
2025-02-27 12:43:59 +00:00
Author: https://github.com/Gingeh
Commit: 591c6b0f68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3712
Reviewed-by: https://github.com/AtkinsSJ ✅
6 changed files with 436 additions and 3 deletions
|
@ -137,14 +137,19 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
|
|||
|
||||
// 3. If element has a form owner:
|
||||
if (form() != nullptr) {
|
||||
// 1. If element is a submit button, then submit element's form owner from element with userInvolvement set to event's user navigation involvement.
|
||||
// 1. If element is a submit button, then submit element's form owner from element with userInvolvement set to event's user navigation involvement, and return.
|
||||
if (is_submit_button()) {
|
||||
form()->submit_form(*this, { .user_involvement = user_navigation_involvement(event) }).release_value_but_fixme_should_propagate_errors();
|
||||
return;
|
||||
}
|
||||
// 2. If element's type attribute is in the Reset Button state, then reset element's form owner.
|
||||
// 2. If element's type attribute is in the Reset Button state, then reset element's form owner, and return.
|
||||
if (type_state() == TypeAttributeState::Reset) {
|
||||
form()->reset_form();
|
||||
return;
|
||||
}
|
||||
// 3. If element's type attribute is in the Auto state, then return.
|
||||
if (type_state() == TypeAttributeState::Auto)
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: 4. Let target be the result of running element's get the commandfor associated element.
|
||||
|
|
|
@ -2696,7 +2696,11 @@ void HTMLInputElement::activation_behavior(DOM::Event const& event)
|
|||
// 2. Run this element's input activation behavior, if any, and do nothing otherwise.
|
||||
run_input_activation_behavior(event).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Run the popover target attribute activation behavior given element and event's target.
|
||||
// 3. If element has a form owner and element's type attribute is not in the Button state, then return.
|
||||
if (form() != nullptr && type_state() != TypeAttributeState::Button)
|
||||
return;
|
||||
|
||||
// 4. Run the popover target attribute activation behavior given element and event's target.
|
||||
if (event.target() && event.target()->is_dom_node())
|
||||
PopoverInvokerElement::popover_target_activation_behaviour(*this, as<DOM::Node>(*event.target()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue