Skip to content

Commit

Permalink
Add missing proc to dom (#20378)
Browse files Browse the repository at this point in the history
* Add missing proc from dom

* Add missing proc from dom

* Add missing proc from dom

Co-authored-by: Clay Sweetser <[email protected]>
  • Loading branch information
juancarlospaco and Varriount authored Sep 19, 2022
1 parent c8000b1 commit 2147b11
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
in `jscore` for JavaScript targets.
- Added `UppercaseLetters`, `LowercaseLetters`, `PunctuationChars`, `PrintableChars` sets to `std/strutils`.
- Added `complex.sgn` for obtaining the phase of complex numbers.
- Added `insertAdjacentText`, `insertAdjacentElement`, `insertAdjacentHTML`,
`after`, `before`, `closest`, `append`, `hasAttributeNS`, `removeAttributeNS`,
`hasPointerCapture`, `releasePointerCapture`, `requestPointerLock`,
`replaceChildren`, `replaceWith`, `scrollIntoViewIfNeeded`, `setHTML`,
`toggleAttribute`, and `matches` to `std/dom`.
- Added [`jsre.hasIndices`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices)

[//]: # "Deprecations:"
Expand Down Expand Up @@ -172,4 +177,3 @@
- Nim now supports Nimble version 0.14 which added support for lock-files. This is done by
a simple configuration change setting that you can do yourself too. In `$nim/config/nim.cfg`
replace `pkgs` by `pkgs2`.

57 changes: 57 additions & 0 deletions lib/js/dom.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1782,3 +1782,60 @@ since (1, 3):

since (1, 5):
proc elementsFromPoint*(n: DocumentOrShadowRoot; x, y: float): seq[Element] {.importcpp.}


since (1, 7):

proc insertAdjacentText*(self: Node; position, data: cstring) {.importjs: "#.$1(#, #)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText

proc insertAdjacentElement*(self: Node; position: cstring; element: Node) {.importjs: "#.$1(#, #)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement

proc insertAdjacentHTML*(self: Node; position, html: cstring) {.importjs: "#.$1(#, #)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML

proc after*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/after

proc before*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/before

proc append*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/append

proc closest*(self: Node; cssSelector: cstring): Node {.importjs: "#.$1(#)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/closest

proc hasAttributeNS*(self: Node; namespace, localName: cstring): bool {.importjs: "(#.$1(#, #) || false)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS

proc removeAttributeNS*(self: Node; namespace, attributeName: cstring) {.importjs: "#.$1(#, #)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS

proc hasPointerCapture*(self: Node; pointerId: SomeNumber): bool {.importjs: "(#.$1(#) || false)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture

proc releasePointerCapture*(self: Node; pointerId: SomeNumber) {.importjs: "#.$1(#)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/releasePointerCapture

proc requestPointerLock*(self: Node) {.importjs: "#.$1()".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock

proc replaceChildren*(self: Node; replacements: Node) {.importjs: "#.$1(@)", varargs.}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren

proc replaceWith*(self: Node; replacements: Node) {.importjs: "#.$1(@)", varargs.}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith

proc scrollIntoViewIfNeeded*(self: Node; centerIfNeeded: bool) {.importjs: "#.$1(#)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded

proc setHTML*(self: Node; html: cstring) {.importjs: "#.$1(#)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTML

proc toggleAttribute*(self: Node; name: cstring; force = false): bool {.importjs: "(#.$1(#, #) || false)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute

proc matches*(self: Node; cssSelector: cstring): bool {.importjs: "(#.$1(#) || false)".}
## https://developer.mozilla.org/en-US/docs/Web/API/Element/matches

0 comments on commit 2147b11

Please sign in to comment.