diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-02-02 19:16:09 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-02-02 19:16:09 +0100 |
| commit | 2e999c9d0901715e970a80efc7a8c870bf3ecab3 (patch) | |
| tree | 5e07473a7df14aa94fb868dc9dd0cb446bc6c4d5 /src | |
| parent | 50d013362893f3f3a0f2a1d232f73508e3933fe0 (diff) | |
| download | chawan-2e999c9d0901715e970a80efc7a8c870bf3ecab3.tar.gz | |
dom: add blur()
Diffstat (limited to 'src')
| -rw-r--r-- | src/html/dom.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index e2083069..1387aa58 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2795,6 +2795,12 @@ proc focus(ctx: JSContext; element: Element) {.jsfunc.} = if window != nil and window.autofocus: element.document.setFocus(element) +proc blur(ctx: JSContext; element: Element) {.jsfunc.} = + let window = ctx.getWindow() + if window != nil and window.autofocus: + if element.document.focus == element: + element.document.setFocus(nil) + proc scrollTo(element: Element) {.jsfunc.} = discard #TODO maybe in app mode? |