Module dom

Declaration of the Document Object Model for the JavaScript backend.


EventTarget* = ref EventTargetObj
Window* = ref WindowObj
Frame* = ref FrameObj
ClassList* = ref ClassListObj
NodeType* = enum
  ElementNode = 1, AttributeNode, TextNode, CDATANode, EntityRefNode, EntityNode,
  ProcessingInstructionNode, CommentNode, DocumentNode, DocumentTypeNode,
  DocumentFragmentNode, NotationNode
Node* = ref NodeObj
Document* = ref DocumentObj
Element* = ref ElementObj
HtmlElement* = ref object of Element
  contentEditable*: string
  isContentEditable*: bool
  dir*: string
  offsetHeight*: int
  offsetWidth*: int
  offsetLeft*: int
  offsetTop*: int
LinkElement* = ref LinkObj
EmbedElement* = ref EmbedObj
AnchorElement* = ref AnchorObj
OptionElement* = ref OptionObj
FormElement* = ref FormObj
ImageElement* = ref ImageObj
Event* = ref EventObj
TouchList* {.importc.} = ref object of RootObj
  length*: int
TouchEvent* {.importc.} = ref object of Event
  changedTouches*, targetTouches*, touches*: TouchList
Touch* {.importc.} = ref object of RootObj
  identifier*: int
  screenX*, screenY*, clientX*, clientY*, pageX*, pageY*: int
  target*: Element
  radiusX*, radiusY*: int
  rotationAngle*: int
  force*: float
Location* = ref LocationObj
History* = ref HistoryObj
TPlugin* {.importc.} = object of RootObj
  description*: cstring
  filename*: cstring
  name*: cstring
TMimeType* {.importc.} = object of RootObj
  description*: cstring
  enabledPlugin*: ref TPlugin
  suffixes*: seq[cstring]
  `type`*: cstring
TLocationBar* {.importc.} = object of RootObj
  visible*: bool
TMenuBar* = TLocationBar
TPersonalBar* = TLocationBar
TScrollBars* = TLocationBar
TToolBar* = TLocationBar
TStatusBar* = TLocationBar
TTimeOut* {.importc.} = object of RootObj
TInterval* {.importc.} = object of RootObj
AddEventListenerOptions* = object
  capture*: bool
  once*: bool
  passive*: bool
TEventHandlers* {.deprecated.} = EventTargetObj
TWindow* {.deprecated.} = WindowObj
TFrame* {.deprecated.} = FrameObj
TNode* {.deprecated.} = NodeObj
TDocument* {.deprecated.} = DocumentObj
TElement* {.deprecated.} = ElementObj
TEmbed* {.deprecated.} = EmbedObj
TAnchor* {.deprecated.} = AnchorObj
TOption* {.deprecated.} = OptionObj
TForm* {.deprecated.} = FormObj
TImage* {.deprecated.} = ImageObj
TNodeType* {.deprecated.} = NodeType
TEvent* {.deprecated.} = EventObj
TLocation* {.deprecated.} = LocationObj
THistory* {.deprecated.} = HistoryObj
TNavigator* {.deprecated.} = NavigatorObj
TStyle* {.deprecated.} = StyleObj
TScreen* {.deprecated.} = ScreenObj
TApplet* {.importc, deprecated.} = object of RootObj


window* {.importc, nodecl.}: Window
document* {.importc, nodecl.}: Document
screen* {.importc, nodecl.}: Screen


proc addEventListener*(et: EventTarget; ev: cstring; cb: proc (ev: Event);
                      useCapture: bool = false)
proc addEventListener*(et: EventTarget; ev: cstring; cb: proc (ev: Event);
                      options: AddEventListenerOptions)
proc alert*(w: Window; msg: cstring)
proc back*(w: Window)
proc blur*(w: Window)
proc captureEvents*(w: Window; eventMask: int) {.deprecated.}
proc clearInterval*(w: Window; interval: ref TInterval)
proc clearTimeout*(w: Window; timeout: ref TTimeOut)
proc close*(w: Window)
proc confirm*(w: Window; msg: cstring): bool
proc disableExternalCapture*(w: Window)
proc enableExternalCapture*(w: Window)
proc find*(w: Window; text: cstring; caseSensitive = false; backwards = false)
proc focus*(w: Window)
proc forward*(w: Window)
proc handleEvent*(w: Window; e: Event)
proc home*(w: Window)
proc moveBy*(w: Window; x, y: int)
proc moveTo*(w: Window; x, y: int)
proc open*(w: Window; uri, windowname: cstring; properties: cstring = nil): Window
proc print*(w: Window)
proc prompt*(w: Window; text, default: cstring): cstring
proc releaseEvents*(w: Window; eventMask: int) {.deprecated.}
proc resizeBy*(w: Window; x, y: int)
proc resizeTo*(w: Window; x, y: int)
proc routeEvent*(w: Window; event: Event)
proc scrollBy*(w: Window; x, y: int)
proc scrollTo*(w: Window; x, y: int)
proc setInterval*(w: Window; code: cstring; pause: int): ref TInterval
proc setInterval*(w: Window; function: proc (); pause: int): ref TInterval
proc setTimeout*(w: Window; code: cstring; pause: int): ref TTimeOut
proc setTimeout*(w: Window; function: proc (); pause: int): ref TInterval
proc stop*(w: Window)
proc requestAnimationFrame*(w: Window; function: proc (time: float)): int
proc cancelAnimationFrame*(w: Window; id: int)
proc appendChild*(n, child: Node)
proc appendData*(n: Node; data: cstring)
proc cloneNode*(n: Node; copyContent: bool): Node
proc deleteData*(n: Node; start, len: int)
proc getAttribute*(n: Node; attr: cstring): cstring
proc getAttributeNode*(n: Node; attr: cstring): Node
proc hasChildNodes*(n: Node): bool
proc insertBefore*(n, newNode, before: Node)
proc insertData*(n: Node; position: int; data: cstring)
proc removeAttribute*(n: Node; attr: cstring)
proc removeAttributeNode*(n, attr: Node)
proc removeChild*(n, child: Node)
proc replaceChild*(n, newNode, oldNode: Node)
proc replaceData*(n: Node; start, len: int; text: cstring)
proc scrollIntoView*(n: Node)
proc setAttribute*(n: Node; name, value: cstring)
proc setAttributeNode*(n: Node; attr: Node)
proc captureEvents*(d: Document; eventMask: int) {.deprecated.}
proc createAttribute*(d: Document; identifier: cstring): Node
proc createElement*(d: Document; identifier: cstring): Element
proc createTextNode*(d: Document; identifier: cstring): Node
proc getElementById*(d: Document; id: cstring): Element
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 getSelection*(d: Document): cstring
proc handleEvent*(d: Document; event: Event)
proc open*(d: Document)
proc releaseEvents*(d: Document; eventMask: int) {.deprecated.}
proc routeEvent*(d: Document; event: Event)
proc write*(d: Document; text: cstring)
proc writeln*(d: Document; text: cstring)
proc querySelector*(d: Document; selectors: cstring): Element
proc querySelectorAll*(d: Document; selectors: cstring): seq[Element]
proc blur*(e: Element)
proc click*(e: Element)
proc focus*(e: Element)
proc handleEvent*(e: Element; event: Event)
proc select*(e: Element)
proc getElementsByTagName*(e: Element; name: cstring): seq[Element]
proc getElementsByClassName*(e: Element; name: cstring): seq[Element]
proc reset*(f: FormElement)
proc submit*(f: FormElement)
proc play*(e: EmbedElement)
proc stop*(e: EmbedElement)
proc reload*(loc: Location)
proc replace*(loc: Location; s: cstring)
proc back*(h: History)
proc forward*(h: History)
proc go*(h: History; pagesToJump: int)
proc javaEnabled*(h: Navigator): bool
proc add*(c: ClassList; class: cstring)
proc remove*(c: ClassList; class: cstring)
proc contains*(c: ClassList; class: cstring): bool
proc toggle*(c: ClassList; class: cstring)
proc getAttribute*(s: Style; attr: cstring; caseSensitive = false): cstring
proc removeAttribute*(s: Style; attr: cstring; caseSensitive = false)
proc setAttribute*(s: Style; attr, value: cstring; caseSensitive = false)
proc preventDefault*(ev: Event)
proc identifiedTouch*(list: TouchList): Touch
proc item*(list: TouchList; i: int): Touch
proc decodeURI*(uri: cstring): cstring {.importc, nodecl.}
proc encodeURI*(uri: cstring): cstring {.importc, nodecl.}
proc escape*(uri: cstring): cstring {.importc, nodecl.}
proc unescape*(uri: cstring): cstring {.importc, nodecl.}
proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
proc isFinite*(x: BiggestFloat): bool {.importc, nodecl.}
proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.}
proc parseFloat*(s: cstring): BiggestFloat {.importc, nodecl.}
proc parseInt*(s: cstring): int {.importc, nodecl.}
proc parseInt*(s: cstring; radix: int): int {.importc, nodecl.}

© 2006–2017 Andreas Rumpf
Licensed under the MIT License.