mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibWeb: Support committing changes to <input> elements
We currently fire the change event on <input> elements when they lose focus. The spec allows for us to also fire the event when changes are "committed", so long as such an action makes sense for the input type. This patch detects when the return key is entered in an <input> element and uses that as the commit action for text-related types. If no change has occurred since the last commit, no change event is fired.
This commit is contained in:
parent
97665fa92f
commit
7edfeb7056
8 changed files with 88 additions and 11 deletions
15
Tests/LibWeb/Text/input/input-commit.html
Normal file
15
Tests/LibWeb/Text/input/input-commit.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<input id=input type=text>
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
let input = document.getElementById("input");
|
||||
|
||||
input.addEventListener("change", () => {
|
||||
println(input.value);
|
||||
done();
|
||||
});
|
||||
|
||||
internals.sendText(input, "wfh :^)");
|
||||
internals.commitText();
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue