summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRainbow Asteroids <rainbow@portal2d.xyz>2021-06-05 03:07:26 -0400
committerGitHub <noreply@github.com>2021-06-05 09:07:26 +0200
commit295429f42595ce5c707456e657e4de6b2734df42 (patch)
tree7b8630227a4f9cdab08ae53b07457a4ad7455a1f
parent3cc547f2dfc3d2a981ccde38adb1f3deeb9715c2 (diff)
downloadNim-295429f42595ce5c707456e657e4de6b2734df42.tar.gz
add `dom.scrollIntoView` with options; refs #18093 (#18181)
-rw-r--r--changelog.md2
-rw-r--r--lib/js/dom.nim6
2 files changed, 8 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index 1050e4916..7619ee6a3 100644
--- a/changelog.md
+++ b/changelog.md
@@ -335,6 +335,8 @@
 
 - Added setCurrentException for JS backend.
 
+- Added `dom.scrollIntoView` proc with options
+
 ## Language changes
 
 - `nimscript` now handles `except Exception as e`.
diff --git a/lib/js/dom.nim b/lib/js/dom.nim
index 16fc96b68..2b2332020 100644
--- a/lib/js/dom.nim
+++ b/lib/js/dom.nim
@@ -1317,6 +1317,11 @@ type
     ready*: FontFaceSetReady
     onloadingdone*: proc(event: Event)
 
+  ScrollIntoViewOptions* = object
+    behavior*: cstring
+    `block`*: cstring
+    inline*: cstring
+
 since (1, 3):
   type
     DomParser* = ref object
@@ -1538,6 +1543,7 @@ proc removeAttribute*(n: Node, attr: cstring)
 proc removeAttributeNode*(n, attr: Node)
 proc replaceData*(n: Node, start, len: int, text: cstring)
 proc scrollIntoView*(n: Node)
+proc scrollIntoView*(n: Node, options: ScrollIntoViewOptions)
 proc setAttribute*(n: Node, name, value: cstring)
 proc setAttributeNode*(n: Node, attr: Node)
 proc querySelector*(n: Node, selectors: cstring): Element