LibWeb: Fix "input" events being dispatched twice when cancelled
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Aliaksandr Kalenik 2024-10-22 23:09:27 +02:00 committed by Tim Flynn
parent 2534e7aeff
commit 648fac7215
Notes: github-actions[bot] 2024-10-22 23:42:01 +00:00
3 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,9 @@
beforeinput data=(r) intputType=(insertText)
beforeinput data=(a) intputType=(insertText)
beforeinput data=(e) intputType=(insertText)
beforeinput data=(b) intputType=(insertText)
beforeinput data=(e) intputType=(insertText)
beforeinput data=(c) intputType=(insertText)
beforeinput data=(e) intputType=(insertText)
beforeinput data=(null) intputType=(insertParagraph)
Text in input: reee

View file

@ -11,11 +11,11 @@
test(() => {
const input = document.getElementById("input");
input.addEventListener("beforeinput", (e) => {
println(`beforeinput data=(${e.data}) intputType=(${e.inputType})`);
if (e.data !== 'r' && e.data !== 'e') {
e.preventDefault();
return;
}
println(`beforeinput data=(${e.data}) intputType=(${e.inputType})`);
});
internals.sendText(input, "raebece");
internals.commitText();

View file

@ -38,8 +38,8 @@
namespace Web {
#define FIRE(event_result) \
if (event_result == EventResult::Cancelled) \
#define FIRE(expression) \
if (auto event_result = (expression); event_result == EventResult::Cancelled) \
return event_result;
static JS::GCPtr<DOM::Node> dom_node_for_event_dispatch(Painting::Paintable& paintable)