diff --git a/Tests/LibWeb/Text/expected/Editing/beforeinput-event.txt b/Tests/LibWeb/Text/expected/Editing/beforeinput-event.txt index e8842c4f473..4faaeea258a 100644 --- a/Tests/LibWeb/Text/expected/Editing/beforeinput-event.txt +++ b/Tests/LibWeb/Text/expected/Editing/beforeinput-event.txt @@ -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 diff --git a/Tests/LibWeb/Text/input/Editing/beforeinput-event.html b/Tests/LibWeb/Text/input/Editing/beforeinput-event.html index 57a39b9f0de..56dfa6ac185 100644 --- a/Tests/LibWeb/Text/input/Editing/beforeinput-event.html +++ b/Tests/LibWeb/Text/input/Editing/beforeinput-event.html @@ -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(); diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index 59bbfcadf3d..4583464d73c 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -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_for_event_dispatch(Painting::Paintable& paintable)