mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 07:24:58 +00:00
LibWeb: Do not issue change
event for every update of color input
Per spec, the change event shall only be issued once the change is finally committed by the user, IE by closing the color picker window.
This commit is contained in:
parent
bad7f0091f
commit
3e3a200eee
3 changed files with 14 additions and 11 deletions
|
@ -348,7 +348,7 @@ void HTMLInputElement::did_edit_text_node(Badge<BrowsingContext>)
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLInputElement::did_pick_color(Optional<Color> picked_color)
|
||||
void HTMLInputElement::did_pick_color(Optional<Color> picked_color, ColorPickerUpdateState state)
|
||||
{
|
||||
// https://html.spec.whatwg.org/multipage/input.html#common-input-element-events
|
||||
// For input elements without a defined input activation behavior, but to which these events apply
|
||||
|
@ -371,14 +371,16 @@ void HTMLInputElement::did_pick_color(Optional<Color> picked_color)
|
|||
});
|
||||
|
||||
// and any time the user commits the change, the user agent must queue an element task on the user interaction task source
|
||||
queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
|
||||
// given the input element
|
||||
// FIXME: to set its user interacted to true
|
||||
// and fire an event named change at the input element, with the bubbles attribute initialized to true.
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
|
||||
change_event->set_bubbles(true);
|
||||
dispatch_event(*change_event);
|
||||
});
|
||||
if (state == ColorPickerUpdateState::Closed) {
|
||||
queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
|
||||
// given the input element
|
||||
// FIXME: to set its user interacted to true
|
||||
// and fire an event named change at the input element, with the bubbles attribute initialized to true.
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change);
|
||||
change_event->set_bubbles(true);
|
||||
dispatch_event(*change_event);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue