1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:24:58 +00:00

LibWeb: Fire a change event on input elements in the focus update steps

This ensures the change event is received before the blur event.
This commit is contained in:
Timothy Flynn 2023-12-03 08:24:16 -05:00 committed by Andreas Kling
parent 301d58e2d9
commit 08ee48606d
5 changed files with 82 additions and 7 deletions

View file

@ -1340,4 +1340,47 @@ void HTMLInputElement::activation_behavior(DOM::Event const&)
run_input_activation_behavior().release_value_but_fixme_should_propagate_errors();
}
bool HTMLInputElement::has_input_activation_behavior() const
{
switch (type_state()) {
case TypeAttributeState::Checkbox:
case TypeAttributeState::Color:
case TypeAttributeState::FileUpload:
case TypeAttributeState::ImageButton:
case TypeAttributeState::RadioButton:
case TypeAttributeState::ResetButton:
case TypeAttributeState::SubmitButton:
return true;
default:
return false;
}
}
// https://html.spec.whatwg.org/multipage/input.html#the-input-element:event-change-2
bool HTMLInputElement::change_event_applies() const
{
switch (type_state()) {
case TypeAttributeState::Checkbox:
case TypeAttributeState::Color:
case TypeAttributeState::Date:
case TypeAttributeState::Email:
case TypeAttributeState::FileUpload:
case TypeAttributeState::LocalDateAndTime:
case TypeAttributeState::Month:
case TypeAttributeState::Number:
case TypeAttributeState::Password:
case TypeAttributeState::RadioButton:
case TypeAttributeState::Range:
case TypeAttributeState::Search:
case TypeAttributeState::Telephone:
case TypeAttributeState::Text:
case TypeAttributeState::Time:
case TypeAttributeState::URL:
case TypeAttributeState::Week:
return true;
default:
return false;
}
}
}