mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 11:39:43 +00:00
LibWeb: Implement dispatching of "beforeinput" event
This commit is contained in:
parent
0de61b0f65
commit
63f502ab0a
Notes:
github-actions[bot]
2024-10-22 12:45:55 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 63f502ab0a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1903
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 42 additions and 1 deletions
24
Tests/LibWeb/Text/input/Editing/beforeinput-event.html
Normal file
24
Tests/LibWeb/Text/input/Editing/beforeinput-event.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<script src="../include.js"></script>
|
||||
<style>
|
||||
#input {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<div id="input" contenteditable="true"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const input = document.getElementById("input");
|
||||
input.addEventListener("beforeinput", (e) => {
|
||||
if (e.data !== 'r' && e.data !== 'e') {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
println(`beforeinput data=(${e.data}) intputType=(${e.inputType})`);
|
||||
});
|
||||
internals.sendText(input, "raebece");
|
||||
internals.commitText();
|
||||
println(`Text in input: ${input.textContent}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue