mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb/HTML: Update submit-button-related spec text
Corresponds to 69110cba07
This commit is contained in:
parent
29d5eda02d
commit
f4d3a01d32
Notes:
github-actions[bot]
2025-02-12 23:47:02 +00:00
Author: https://github.com/AtkinsSJ
Commit: f4d3a01d32
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3555
Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 9 additions and 19 deletions
|
@ -252,8 +252,8 @@ bool FormAssociatedElement::is_candidate_for_constraint_validation() const
|
||||||
auto const& button_element = as<HTMLButtonElement>(html_element);
|
auto const& button_element = as<HTMLButtonElement>(html_element);
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element%3Abarred-from-constraint-validation
|
// https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element%3Abarred-from-constraint-validation
|
||||||
// If the type attribute is in the Reset Button state or the Button state, the element is barred from constraint validation.
|
// If the element is not a submit button, the element is barred from constraint validation.
|
||||||
if (button_element.type_state() == HTMLButtonElement::TypeAttributeState::Button || button_element.type_state() == HTMLButtonElement::TypeAttributeState::Reset)
|
if (!button_element.is_submit_button())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ i32 HTMLButtonElement::default_tab_index_value() const
|
||||||
// https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element:concept-submit-button
|
// https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element:concept-submit-button
|
||||||
bool HTMLButtonElement::is_submit_button() const
|
bool HTMLButtonElement::is_submit_button() const
|
||||||
{
|
{
|
||||||
// If the type attribute is in the Submit Button state, the element is specifically a submit button.
|
// A button element is said to be a submit button if the type attribute is in the Submit Button state.
|
||||||
return type_state() == TypeAttributeState::Submit;
|
return type_state() == TypeAttributeState::Submit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,25 +94,15 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
|
||||||
if (!this->document().is_fully_active())
|
if (!this->document().is_fully_active())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 3. If element has a form owner then switch on element's type attribute's state, then:
|
// 3. If element has a form owner:
|
||||||
if (form() != nullptr) {
|
if (form() != nullptr) {
|
||||||
switch (type_state()) {
|
// 1. If element is a submit button, then submit element's form owner from element with userInvolvement set to event's user navigation involvement.
|
||||||
case TypeAttributeState::Submit:
|
if (is_submit_button()) {
|
||||||
// Submit Button
|
|
||||||
// Submit element's form owner from element with userInvolvement set to event's user navigation involvement.
|
|
||||||
form()->submit_form(*this, { .user_involvement = user_navigation_involvement(event) }).release_value_but_fixme_should_propagate_errors();
|
form()->submit_form(*this, { .user_involvement = user_navigation_involvement(event) }).release_value_but_fixme_should_propagate_errors();
|
||||||
break;
|
}
|
||||||
case TypeAttributeState::Reset:
|
// 2. If element's type attribute is in the Reset Button state, then reset element's form owner.
|
||||||
// Reset Button
|
if (type_state() == TypeAttributeState::Reset) {
|
||||||
// Reset element's form owner.
|
|
||||||
form()->reset_form();
|
form()->reset_form();
|
||||||
break;
|
|
||||||
case TypeAttributeState::Button:
|
|
||||||
// Button
|
|
||||||
// Do nothing.
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue