mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
Shadow Dom apis (#14979)
* shadow dom api * fix typos * host to Element type * fix code style * move elementsFromPoint to dom_extensions.nim
This commit is contained in:
@@ -1324,6 +1324,26 @@ since (1, 3):
|
||||
FileReaderObj {.importc.} = object of EventTargetObj
|
||||
|
||||
FileReaderState* = distinct range[0'u16..2'u16]
|
||||
RootNodeOptions* = object of RootObj
|
||||
composed*: bool
|
||||
DocumentOrShadowRoot* {.importc.} = object of RootObj
|
||||
activeElement*: Element
|
||||
# styleSheets*: StyleSheetList
|
||||
ShadowRoot* = ref ShadowRootObj
|
||||
ShadowRootObj {.importc.} = object of DocumentOrShadowRoot
|
||||
delegatesFocus*: bool
|
||||
host*: Element
|
||||
innerHTML*: cstring
|
||||
mode*: cstring # "open" or "closed"
|
||||
ShadowRootInit* = object of RootObj
|
||||
mode*: cstring
|
||||
delegatesFocus*: bool
|
||||
|
||||
HTMLSlotElement* = ref HTMLSlotElementObj
|
||||
HTMLSlotElementObj {.importc.} = object of RootObj
|
||||
name*: cstring
|
||||
SlotOptions* = object of RootObj
|
||||
flatten*: bool
|
||||
|
||||
const
|
||||
fileReaderEmpty* = 0.FileReaderState
|
||||
@@ -1503,6 +1523,18 @@ proc contains*(n: Node): bool
|
||||
proc isEqualNode*(n: Node): bool
|
||||
proc isSameNode*(n: Node): bool
|
||||
|
||||
since (1, 3):
|
||||
proc getRootNode*(n: Node,options: RootNodeOptions): Node
|
||||
|
||||
# DocumentOrShadowRoot
|
||||
proc getSelection*(n: DocumentOrShadowRoot): Selection
|
||||
proc elementFromPoint*(n: DocumentOrShadowRoot; x, y: float): Element
|
||||
|
||||
# shadow dom
|
||||
proc attachShadow*(n: Element): ShadowRoot
|
||||
proc assignedNodes*(n: HTMLSlotElement; options: SlotOptions): seq[Node]
|
||||
proc assignedElements*(n: HTMLSlotElement; options: SlotOptions): seq[Element]
|
||||
|
||||
# Document "methods"
|
||||
proc createAttribute*(d: Document, identifier: cstring): Node
|
||||
proc getElementsByName*(d: Document, name: cstring): seq[Element]
|
||||
|
||||
5
lib/js/dom_extensions.nim
Normal file
5
lib/js/dom_extensions.nim
Normal file
@@ -0,0 +1,5 @@
|
||||
import dom
|
||||
|
||||
{.push importcpp.}
|
||||
proc elementsFromPoint*(n: DocumentOrShadowRoot; x, y: float): seq[Element]
|
||||
{.pop.}
|
||||
Reference in New Issue
Block a user