aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-19 19:37:40 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-19 19:37:40 +0100
commit4dc5d17341d8882e52539e3266a1d511eadf4bb8 (patch)
treef025075c369bc703ef667cbda672b2c8fa6e9a36 /src
parent928a2c3dc3946883ad878532f8081d79f839762c (diff)
downloadchawan-4dc5d17341d8882e52539e3266a1d511eadf4bb8.tar.gz
event: fix preventDefault with stopImmediatePropagation
canceled was not being set, because we jumped out of the loop too early.
Diffstat (limited to 'src')
-rw-r--r--src/html/event.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/html/event.nim b/src/html/event.nim
index 551552d4..16772c28 100644
--- a/src/html/event.nim
+++ b/src/html/event.nim
@@ -303,13 +303,12 @@ proc dispatchEvent0(ctx: JSContext; event: Event; currentTarget: EventTarget;
if JS_IsException(e):
ctx.logException()
JS_FreeValue(ctx, e)
- if efStopImmediatePropagation in event.flags:
- stop = true
- break
- if efStopPropagation in event.flags:
- stop = true
if efCanceled in event.flags:
canceled = true
+ if {efStopPropagation, efStopImmediatePropagation} * event.flags != {}:
+ stop = true
+ if efStopImmediatePropagation in event.flags:
+ break
proc dispatch*(ctx: JSContext; target: EventTarget; event: Event): bool =
#TODO this is far from being compliant