mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Don't trigger onchange event when setting <select> value
This commit is contained in:
parent
f88acedc8f
commit
5d00211a86
Notes:
github-actions[bot]
2024-10-08 17:04:48 +00:00
Author: https://github.com/Arhcout
Commit: 5d00211a86
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1522
Reviewed-by: https://github.com/gmta ✅
3 changed files with 27 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<select id="select-test">
|
||||||
|
<option value="A"></option>
|
||||||
|
<option value="B"></option>
|
||||||
|
</select>
|
||||||
|
<script>
|
||||||
|
asyncTest(done => {
|
||||||
|
const selectElement = document.getElementById("select-test");
|
||||||
|
let onchangeTriggered = false;
|
||||||
|
|
||||||
|
selectElement.onchange = () => {
|
||||||
|
onchangeTriggered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectElement.value = "B";
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!onchangeTriggered) {
|
||||||
|
println("PASS");
|
||||||
|
} else {
|
||||||
|
println("FAILED");
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
}, 1);
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -295,7 +295,6 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::set_value(String const& value)
|
||||||
for (auto const& option_element : list_of_options())
|
for (auto const& option_element : list_of_options())
|
||||||
option_element->set_selected(option_element->value() == value);
|
option_element->set_selected(option_element->value() == value);
|
||||||
update_inner_text_element();
|
update_inner_text_element();
|
||||||
queue_input_and_change_events();
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue