Skip to content

Commit

Permalink
LibWeb: Don't trigger onchange event when setting <select> value
Browse files Browse the repository at this point in the history
  • Loading branch information
Arhcout authored and awesomekling committed Oct 8, 2024
1 parent f88aced commit 5d00211
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PASS
Original file line number Diff line number Diff line change
@@ -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>
1 change: 0 additions & 1 deletion Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::set_value(String const& value)
for (auto const& option_element : list_of_options())
option_element->set_selected(option_element->value() == value);
update_inner_text_element();
queue_input_and_change_events();
return {};
}

Expand Down

0 comments on commit 5d00211

Please sign in to comment.