diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/html/dom.nim | 3 | ||||
-rw-r--r-- | src/server/buffer.nim | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 9b092e3d..123296f5 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2479,8 +2479,6 @@ proc dispatchEvent*(window: Window; event: Event; target: EventTarget): #TODO this is far from being compliant var called = false var canceled = false - let ctx = window.jsctx - var jsEvent = ctx.toJS(event) var stop = false window.dispatchEvent0(event, target, called, stop, canceled) if not stop and target of Node: @@ -2488,7 +2486,6 @@ proc dispatchEvent*(window: Window; event: Event; target: EventTarget): window.dispatchEvent0(event, a, called, stop, canceled) if stop: break - JS_FreeValue(ctx, jsEvent) return (called, canceled) proc fireEvent*(window: Window; name: StaticAtom; target: EventTarget) = diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 424c210f..fa63f3a9 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -1567,10 +1567,11 @@ proc click*(buffer: Buffer; cursorx, cursory: int): ClickResult {.proxy.} = let clickable = buffer.getCursorClickable(cursorx, cursory) if buffer.config.scripting: let element = buffer.getCursorElement(cursorx, cursory) - let event = newEvent(buffer.window.toAtom(satClick), element) - (called, canceled) = buffer.window.dispatchEvent(event, element) - if called: - buffer.do_reshape() + if element != nil: + let event = newEvent(buffer.window.toAtom(satClick), element) + (called, canceled) = buffer.window.dispatchEvent(event, element) + if called: + buffer.do_reshape() if not canceled: if clickable != nil: var res = buffer.click(clickable) |