diff options
author | treeform <starplant@gmail.com> | 2020-07-09 00:18:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 09:18:27 +0200 |
commit | 399b2e3134751432f66a2414fbaf9c2a168fa953 (patch) | |
tree | 31a6b948d1169f905b5e0ab6a50ab02d7dcf2542 /lib | |
parent | 00528cbc3c82ba33e8b9b551d5d86b1b6382c34a (diff) | |
download | Nim-399b2e3134751432f66a2414fbaf9c2a168fa953.tar.gz |
Add missing dom.nim things (#14944)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/dom.nim | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/js/dom.nim b/lib/js/dom.nim index 09e45c04d..575ec3deb 100644 --- a/lib/js/dom.nim +++ b/lib/js/dom.nim @@ -106,7 +106,17 @@ type memory*: PerformanceMemory timing*: PerformanceTiming - Selection* {.importc.} = ref object ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Selection>`_ + Range* {.importc.} = ref object + ## see `docs{https://developer.mozilla.org/en-US/docs/Web/API/Range}`_ + collapsed*: bool + commonAncestorContainer*: Node + endContainer*: Node + endOffset*: int + startContainer*: Node + startOffset*: int + + Selection* {.importc.} = ref object + ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Selection>`_ anchorNode*: Node anchorOffset*: int focusNode*: Node @@ -210,6 +220,7 @@ type applets*: seq[Element] embeds*: seq[EmbedElement] links*: seq[LinkElement] + fonts*: FontFaceSet Element* = ref ElementObj ElementObj {.importc.} = object of NodeObj @@ -1189,6 +1200,10 @@ type ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DragEvent>`_ dataTransfer*: DataTransfer + ClipboardEvent* {.importc.} = object of Event + ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent>`_ + clipboardData*: DataTransfer + TouchList* {.importc.} = ref object of RootObj length*: int @@ -1268,6 +1283,15 @@ type once*: bool passive*: bool + FontFaceSetReady* {.importc.} = ref object + ## see: `docs<https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/ready>`_ + then*: proc(cb: proc()) + + FontFaceSet* {.importc.} = ref object + ## see: `docs<https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet>`_ + ready*: FontFaceSetReady + onloadingdone*: proc(event: Event) + since (1, 3): type DomParser* = ref object @@ -1393,6 +1417,7 @@ else: proc getElementById*(id: cstring): Element {.importc: "document.getElementById", nodecl.} proc appendChild*(n, child: Node) {.importcpp.} proc removeChild*(n, child: Node) {.importcpp.} + proc remove*(child: Node) {.importcpp.} proc replaceChild*(n, newNode, oldNode: Node) {.importcpp.} proc insertBefore*(n, newNode, before: Node) {.importcpp.} proc getElementById*(d: Document, id: cstring): Element {.importcpp.} @@ -1454,7 +1479,7 @@ proc deleteData*(n: Node, start, len: int) proc focus*(e: Node) proc getAttribute*(n: Node, attr: cstring): cstring proc getAttributeNode*(n: Node, attr: cstring): Node -proc hasAttribute*(n: Node; attr: cstring): bool +proc hasAttribute*(n: Node, attr: cstring): bool proc hasChildNodes*(n: Node): bool proc insertData*(n: Node, position: int, data: cstring) proc removeAttribute*(n: Node, attr: cstring) @@ -1471,6 +1496,7 @@ proc createAttribute*(d: Document, identifier: cstring): Node proc getElementsByName*(d: Document, name: cstring): seq[Element] proc getElementsByTagName*(d: Document, name: cstring): seq[Element] proc getElementsByClassName*(d: Document, name: cstring): seq[Element] +proc insertNode*(range: Range, node: Node) proc getSelection*(d: Document): Selection proc handleEvent*(d: Document, event: Event) proc open*(d: Document) @@ -1562,6 +1588,8 @@ proc now*(p: Performance): float # Selection "methods" proc removeAllRanges*(s: Selection) +proc deleteFromDocument*(s: Selection) +proc getRangeAt*(s: Selection, index: int): Range converter toString*(s: Selection): cstring proc `$`*(s: Selection): string = $(s.toString()) |