mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 09:48:47 +00:00
LibWeb: Implement activation behavior on input[type=reset]
This fixes WPT html/semantics/forms/resetting-a-form/reset-form.html. I added a test based on the WPT test, but simpler.
This commit is contained in:
parent
90bb8ed33e
commit
caf74e7ed6
Notes:
github-actions[bot]
2024-10-11 06:41:46 +00:00
Author: https://github.com/ferk6a 🔰
Commit: caf74e7ed6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1716
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 86 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
* Copyright (c) 2023-2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@gmta.nl>
|
||||
* Copyright (c) 2024, Fernando Kiotheka <fer@k6a.dev>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -406,6 +407,20 @@ WebIDL::ExceptionOr<void> HTMLInputElement::run_input_activation_behavior(DOM::E
|
|||
// 4. Submit the element's form owner from the element with userInvolvement set to event's user navigation involvement.
|
||||
TRY(form->submit_form(*this, { .user_involvement = user_navigation_involvement(event) }));
|
||||
}
|
||||
// https://html.spec.whatwg.org/multipage/input.html#reset-button-state-(type=reset)
|
||||
else if (type_state() == TypeAttributeState::ResetButton) {
|
||||
// 1. If the element does not have a form owner, then return.
|
||||
auto* form = this->form();
|
||||
if (!form)
|
||||
return {};
|
||||
|
||||
// 2. If the element's node document is not fully active, then return.
|
||||
if (!document().is_fully_active())
|
||||
return {};
|
||||
|
||||
// 3. Reset the form owner from the element.
|
||||
form->reset_form();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue