commit
0dcaf27b64
1 changed files with 173 additions and 133 deletions
306
lib/js/dom.nim
306
lib/js/dom.nim
|
|
@ -14,36 +14,35 @@ when not defined(js) and not defined(Nimdoc):
|
||||||
{.error: "This module only works on the JavaScript platform".}
|
{.error: "This module only works on the JavaScript platform".}
|
||||||
|
|
||||||
type
|
type
|
||||||
TEventHandlers* {.importc.} = object of RootObj
|
EventTarget* = ref EventTargetObj
|
||||||
onabort*: proc (event: ref TEvent) {.nimcall.}
|
EventTargetObj {.importc.} = object of RootObj
|
||||||
onblur*: proc (event: ref TEvent) {.nimcall.}
|
onabort*: proc (event: Event) {.nimcall.}
|
||||||
onchange*: proc (event: ref TEvent) {.nimcall.}
|
onblur*: proc (event: Event) {.nimcall.}
|
||||||
onclick*: proc (event: ref TEvent) {.nimcall.}
|
onchange*: proc (event: Event) {.nimcall.}
|
||||||
ondblclick*: proc (event: ref TEvent) {.nimcall.}
|
onclick*: proc (event: Event) {.nimcall.}
|
||||||
onerror*: proc (event: ref TEvent) {.nimcall.}
|
ondblclick*: proc (event: Event) {.nimcall.}
|
||||||
onfocus*: proc (event: ref TEvent) {.nimcall.}
|
onerror*: proc (event: Event) {.nimcall.}
|
||||||
onkeydown*: proc (event: ref TEvent) {.nimcall.}
|
onfocus*: proc (event: Event) {.nimcall.}
|
||||||
onkeypress*: proc (event: ref TEvent) {.nimcall.}
|
onkeydown*: proc (event: Event) {.nimcall.}
|
||||||
onkeyup*: proc (event: ref TEvent) {.nimcall.}
|
onkeypress*: proc (event: Event) {.nimcall.}
|
||||||
onload*: proc (event: ref TEvent) {.nimcall.}
|
onkeyup*: proc (event: Event) {.nimcall.}
|
||||||
onmousedown*: proc (event: ref TEvent) {.nimcall.}
|
onload*: proc (event: Event) {.nimcall.}
|
||||||
onmousemove*: proc (event: ref TEvent) {.nimcall.}
|
onmousedown*: proc (event: Event) {.nimcall.}
|
||||||
onmouseout*: proc (event: ref TEvent) {.nimcall.}
|
onmousemove*: proc (event: Event) {.nimcall.}
|
||||||
onmouseover*: proc (event: ref TEvent) {.nimcall.}
|
onmouseout*: proc (event: Event) {.nimcall.}
|
||||||
onmouseup*: proc (event: ref TEvent) {.nimcall.}
|
onmouseover*: proc (event: Event) {.nimcall.}
|
||||||
onreset*: proc (event: ref TEvent) {.nimcall.}
|
onmouseup*: proc (event: Event) {.nimcall.}
|
||||||
onselect*: proc (event: ref TEvent) {.nimcall.}
|
onreset*: proc (event: Event) {.nimcall.}
|
||||||
onsubmit*: proc (event: ref TEvent) {.nimcall.}
|
onselect*: proc (event: Event) {.nimcall.}
|
||||||
onunload*: proc (event: ref TEvent) {.nimcall.}
|
onsubmit*: proc (event: Event) {.nimcall.}
|
||||||
|
onunload*: proc (event: Event) {.nimcall.}
|
||||||
addEventListener*: proc(ev: cstring, cb: proc(ev: ref TEvent), useCapture: bool = false) {.nimcall.}
|
|
||||||
|
|
||||||
Window* = ref WindowObj
|
Window* = ref WindowObj
|
||||||
WindowObj {.importc.} = object of TEventHandlers
|
WindowObj {.importc.} = object of EventTargetObj
|
||||||
document*: Document
|
document*: Document
|
||||||
event*: ref TEvent
|
event*: Event
|
||||||
history*: ref THistory
|
history*: History
|
||||||
location*: ref TLocation
|
location*: Location
|
||||||
closed*: bool
|
closed*: bool
|
||||||
defaultStatus*: cstring
|
defaultStatus*: cstring
|
||||||
innerHeight*, innerWidth*: int
|
innerHeight*, innerWidth*: int
|
||||||
|
|
@ -57,50 +56,15 @@ type
|
||||||
statusbar*: ref TStatusBar
|
statusbar*: ref TStatusBar
|
||||||
status*: cstring
|
status*: cstring
|
||||||
toolbar*: ref TToolBar
|
toolbar*: ref TToolBar
|
||||||
|
|
||||||
alert*: proc (msg: cstring) {.nimcall.}
|
|
||||||
back*: proc () {.nimcall.}
|
|
||||||
blur*: proc () {.nimcall.}
|
|
||||||
captureEvents*: proc (eventMask: int) {.nimcall.}
|
|
||||||
clearInterval*: proc (interval: ref TInterval) {.nimcall.}
|
|
||||||
clearTimeout*: proc (timeout: ref TTimeOut) {.nimcall.}
|
|
||||||
close*: proc () {.nimcall.}
|
|
||||||
confirm*: proc (msg: cstring): bool {.nimcall.}
|
|
||||||
disableExternalCapture*: proc () {.nimcall.}
|
|
||||||
enableExternalCapture*: proc () {.nimcall.}
|
|
||||||
find*: proc (text: cstring, caseSensitive = false,
|
|
||||||
backwards = false) {.nimcall.}
|
|
||||||
focus*: proc () {.nimcall.}
|
|
||||||
forward*: proc () {.nimcall.}
|
|
||||||
handleEvent*: proc (e: ref TEvent) {.nimcall.}
|
|
||||||
home*: proc () {.nimcall.}
|
|
||||||
moveBy*: proc (x, y: int) {.nimcall.}
|
|
||||||
moveTo*: proc (x, y: int) {.nimcall.}
|
|
||||||
open*: proc (uri, windowname: cstring,
|
|
||||||
properties: cstring = nil): Window {.nimcall.}
|
|
||||||
print*: proc () {.nimcall.}
|
|
||||||
prompt*: proc (text, default: cstring): cstring {.nimcall.}
|
|
||||||
releaseEvents*: proc (eventMask: int) {.nimcall.}
|
|
||||||
resizeBy*: proc (x, y: int) {.nimcall.}
|
|
||||||
resizeTo*: proc (x, y: int) {.nimcall.}
|
|
||||||
routeEvent*: proc (event: ref TEvent) {.nimcall.}
|
|
||||||
scrollBy*: proc (x, y: int) {.nimcall.}
|
|
||||||
scrollTo*: proc (x, y: int) {.nimcall.}
|
|
||||||
setInterval*: proc (code: cstring, pause: int): ref TInterval {.nimcall.}
|
|
||||||
setTimeout*: proc (code: cstring, pause: int): ref TTimeOut {.nimcall.}
|
|
||||||
stop*: proc () {.nimcall.}
|
|
||||||
frames*: seq[TFrame]
|
frames*: seq[TFrame]
|
||||||
|
|
||||||
Frame* = ref FrameObj
|
Frame* = ref FrameObj
|
||||||
FrameObj {.importc.} = object of WindowObj
|
FrameObj {.importc.} = object of WindowObj
|
||||||
|
|
||||||
ClassList* {.importc.} = object of RootObj
|
ClassList* = ref ClassListObj
|
||||||
add*: proc (class: cstring) {.nimcall.}
|
ClassListObj {.importc.} = object of RootObj
|
||||||
remove*: proc (class: cstring) {.nimcall.}
|
|
||||||
contains*: proc (class: cstring):bool {.nimcall.}
|
|
||||||
toggle*: proc (class: cstring) {.nimcall.}
|
|
||||||
|
|
||||||
TNodeType* = enum
|
NodeType* = enum
|
||||||
ElementNode = 1,
|
ElementNode = 1,
|
||||||
AttributeNode,
|
AttributeNode,
|
||||||
TextNode,
|
TextNode,
|
||||||
|
|
@ -115,7 +79,7 @@ type
|
||||||
NotationNode
|
NotationNode
|
||||||
|
|
||||||
Node* = ref NodeObj
|
Node* = ref NodeObj
|
||||||
NodeObj {.importc.} = object of TEventHandlers
|
NodeObj {.importc.} = object of EventTargetObj
|
||||||
attributes*: seq[Node]
|
attributes*: seq[Node]
|
||||||
childNodes*: seq[Node]
|
childNodes*: seq[Node]
|
||||||
children*: seq[Node]
|
children*: seq[Node]
|
||||||
|
|
@ -124,29 +88,12 @@ type
|
||||||
lastChild*: Node
|
lastChild*: Node
|
||||||
nextSibling*: Node
|
nextSibling*: Node
|
||||||
nodeName*: cstring
|
nodeName*: cstring
|
||||||
nodeType*: TNodeType
|
nodeType*: NodeType
|
||||||
nodeValue*: cstring
|
nodeValue*: cstring
|
||||||
parentNode*: Node
|
parentNode*: Node
|
||||||
previousSibling*: Node
|
previousSibling*: Node
|
||||||
appendChild*: proc (child: Node) {.nimcall.}
|
|
||||||
appendData*: proc (data: cstring) {.nimcall.}
|
|
||||||
cloneNode*: proc (copyContent: bool): Node {.nimcall.}
|
|
||||||
deleteData*: proc (start, len: int) {.nimcall.}
|
|
||||||
getAttribute*: proc (attr: cstring): cstring {.nimcall.}
|
|
||||||
getAttributeNode*: proc (attr: cstring): Node {.nimcall.}
|
|
||||||
hasChildNodes*: proc (): bool {.nimcall.}
|
|
||||||
innerHTML*: cstring
|
innerHTML*: cstring
|
||||||
insertBefore*: proc (newNode, before: Node) {.nimcall.}
|
style*: Style
|
||||||
insertData*: proc (position: int, data: cstring) {.nimcall.}
|
|
||||||
removeAttribute*: proc (attr: cstring) {.nimcall.}
|
|
||||||
removeAttributeNode*: proc (attr: Node) {.nimcall.}
|
|
||||||
removeChild*: proc (child: Node) {.nimcall.}
|
|
||||||
replaceChild*: proc (newNode, oldNode: Node) {.nimcall.}
|
|
||||||
replaceData*: proc (start, len: int, text: cstring) {.nimcall.}
|
|
||||||
scrollIntoView*: proc () {.nimcall.}
|
|
||||||
setAttribute*: proc (name, value: cstring) {.nimcall.}
|
|
||||||
setAttributeNode*: proc (attr: Node) {.nimcall.}
|
|
||||||
style*: ref TStyle
|
|
||||||
|
|
||||||
Document* = ref DocumentObj
|
Document* = ref DocumentObj
|
||||||
DocumentObj {.importc.} = object of NodeObj
|
DocumentObj {.importc.} = object of NodeObj
|
||||||
|
|
@ -164,31 +111,16 @@ type
|
||||||
title*: cstring
|
title*: cstring
|
||||||
URL*: cstring
|
URL*: cstring
|
||||||
vlinkColor*: cstring
|
vlinkColor*: cstring
|
||||||
captureEvents*: proc (eventMask: int) {.nimcall.}
|
|
||||||
createAttribute*: proc (identifier: cstring): Node {.nimcall.}
|
|
||||||
createElement*: proc (identifier: cstring): Element {.nimcall.}
|
|
||||||
createTextNode*: proc (identifier: cstring): Node {.nimcall.}
|
|
||||||
getElementById*: proc (id: cstring): Element {.nimcall.}
|
|
||||||
getElementsByName*: proc (name: cstring): seq[Element] {.nimcall.}
|
|
||||||
getElementsByTagName*: proc (name: cstring): seq[Element] {.nimcall.}
|
|
||||||
getElementsByClassName*: proc (name: cstring): seq[Element] {.nimcall.}
|
|
||||||
getSelection*: proc (): cstring {.nimcall.}
|
|
||||||
handleEvent*: proc (event: ref TEvent) {.nimcall.}
|
|
||||||
open*: proc () {.nimcall.}
|
|
||||||
releaseEvents*: proc (eventMask: int) {.nimcall.}
|
|
||||||
routeEvent*: proc (event: ref TEvent) {.nimcall.}
|
|
||||||
write*: proc (text: cstring) {.nimcall.}
|
|
||||||
writeln*: proc (text: cstring) {.nimcall.}
|
|
||||||
anchors*: seq[AnchorElement]
|
anchors*: seq[AnchorElement]
|
||||||
forms*: seq[FormElement]
|
forms*: seq[FormElement]
|
||||||
images*: seq[ImageElement]
|
images*: seq[ImageElement]
|
||||||
applets*: seq[ref TApplet]
|
applets*: seq[Element]
|
||||||
embeds*: seq[EmbedElement]
|
embeds*: seq[EmbedElement]
|
||||||
links*: seq[LinkElement]
|
links*: seq[LinkElement]
|
||||||
|
|
||||||
Element* = ref ElementObj
|
Element* = ref ElementObj
|
||||||
ElementObj {.importc.} = object of NodeObj
|
ElementObj {.importc.} = object of NodeObj
|
||||||
classList*: ref Classlist
|
classList*: Classlist
|
||||||
checked*: bool
|
checked*: bool
|
||||||
defaultChecked*: bool
|
defaultChecked*: bool
|
||||||
defaultValue*: cstring
|
defaultValue*: cstring
|
||||||
|
|
@ -196,14 +128,7 @@ type
|
||||||
form*: FormElement
|
form*: FormElement
|
||||||
name*: cstring
|
name*: cstring
|
||||||
readOnly*: bool
|
readOnly*: bool
|
||||||
blur*: proc () {.nimcall.}
|
|
||||||
click*: proc () {.nimcall.}
|
|
||||||
focus*: proc () {.nimcall.}
|
|
||||||
handleEvent*: proc (event: ref TEvent) {.nimcall.}
|
|
||||||
select*: proc () {.nimcall.}
|
|
||||||
options*: seq[OptionElement]
|
options*: seq[OptionElement]
|
||||||
getElementsByTagName*: proc (name: cstring): seq[Element] {.nimcall.}
|
|
||||||
getElementsByClassName*: proc (name: cstring): seq[Element] {.nimcall.}
|
|
||||||
|
|
||||||
LinkElement* = ref LinkObj
|
LinkElement* = ref LinkObj
|
||||||
LinkObj {.importc.} = object of ElementObj
|
LinkObj {.importc.} = object of ElementObj
|
||||||
|
|
@ -220,16 +145,12 @@ type
|
||||||
width*: int
|
width*: int
|
||||||
`type`*: cstring
|
`type`*: cstring
|
||||||
vspace*: int
|
vspace*: int
|
||||||
play*: proc () {.nimcall.}
|
|
||||||
stop*: proc () {.nimcall.}
|
|
||||||
|
|
||||||
AnchorElement* = ref AnchorObj
|
AnchorElement* = ref AnchorObj
|
||||||
AnchorObj {.importc.} = object of ElementObj
|
AnchorObj {.importc.} = object of ElementObj
|
||||||
text*: cstring
|
text*: cstring
|
||||||
x*, y*: int
|
x*, y*: int
|
||||||
|
|
||||||
TApplet* {.importc.} = object of RootObj
|
|
||||||
|
|
||||||
OptionElement* = ref OptionObj
|
OptionElement* = ref OptionObj
|
||||||
OptionObj {.importc.} = object of ElementObj
|
OptionObj {.importc.} = object of ElementObj
|
||||||
defaultSelected*: bool
|
defaultSelected*: bool
|
||||||
|
|
@ -244,8 +165,6 @@ type
|
||||||
encoding*: cstring
|
encoding*: cstring
|
||||||
`method`*: cstring
|
`method`*: cstring
|
||||||
target*: cstring
|
target*: cstring
|
||||||
reset*: proc () {.nimcall.}
|
|
||||||
submit*: proc () {.nimcall.}
|
|
||||||
elements*: seq[Element]
|
elements*: seq[Element]
|
||||||
|
|
||||||
ImageElement* = ref ImageObj
|
ImageElement* = ref ImageObj
|
||||||
|
|
@ -259,8 +178,8 @@ type
|
||||||
vspace*: int
|
vspace*: int
|
||||||
width*: int
|
width*: int
|
||||||
|
|
||||||
|
Style = ref StyleObj
|
||||||
TStyle* {.importc.} = object of RootObj
|
StyleObj {.importc.} = object of RootObj
|
||||||
background*: cstring
|
background*: cstring
|
||||||
backgroundAttachment*: cstring
|
backgroundAttachment*: cstring
|
||||||
backgroundColor*: cstring
|
backgroundColor*: cstring
|
||||||
|
|
@ -350,11 +269,9 @@ type
|
||||||
width*: cstring
|
width*: cstring
|
||||||
wordSpacing*: cstring
|
wordSpacing*: cstring
|
||||||
zIndex*: int
|
zIndex*: int
|
||||||
getAttribute*: proc (attr: cstring, caseSensitive=false): cstring {.nimcall.}
|
|
||||||
removeAttribute*: proc (attr: cstring, caseSensitive=false) {.nimcall.}
|
|
||||||
setAttribute*: proc (attr, value: cstring, caseSensitive=false) {.nimcall.}
|
|
||||||
|
|
||||||
TEvent* {.importc.} = object of RootObj
|
Event* = ref EventObj
|
||||||
|
EventObj {.importc.} = object of RootObj
|
||||||
target*: Node
|
target*: Node
|
||||||
altKey*, ctrlKey*, shiftKey*: bool
|
altKey*, ctrlKey*, shiftKey*: bool
|
||||||
button*: int
|
button*: int
|
||||||
|
|
@ -393,7 +310,8 @@ type
|
||||||
SUBMIT*: int
|
SUBMIT*: int
|
||||||
UNLOAD*: int
|
UNLOAD*: int
|
||||||
|
|
||||||
TLocation* {.importc.} = object of RootObj
|
Location* = ref LocationObj
|
||||||
|
LocationObj {.importc.} = object of RootObj
|
||||||
hash*: cstring
|
hash*: cstring
|
||||||
host*: cstring
|
host*: cstring
|
||||||
hostname*: cstring
|
hostname*: cstring
|
||||||
|
|
@ -402,16 +320,13 @@ type
|
||||||
port*: cstring
|
port*: cstring
|
||||||
protocol*: cstring
|
protocol*: cstring
|
||||||
search*: cstring
|
search*: cstring
|
||||||
reload*: proc () {.nimcall.}
|
|
||||||
replace*: proc (s: cstring) {.nimcall.}
|
|
||||||
|
|
||||||
THistory* {.importc.} = object of RootObj
|
History* = ref HistoryObj
|
||||||
|
HistoryObj {.importc.} = object of RootObj
|
||||||
length*: int
|
length*: int
|
||||||
back*: proc () {.nimcall.}
|
|
||||||
forward*: proc () {.nimcall.}
|
|
||||||
go*: proc (pagesToJump: int) {.nimcall.}
|
|
||||||
|
|
||||||
TNavigator* {.importc.} = object of RootObj
|
Navigator* = ref NavigatorObj
|
||||||
|
NavigatorObj {.importc.} = object of RootObj
|
||||||
appCodeName*: cstring
|
appCodeName*: cstring
|
||||||
appName*: cstring
|
appName*: cstring
|
||||||
appVersion*: cstring
|
appVersion*: cstring
|
||||||
|
|
@ -419,7 +334,6 @@ type
|
||||||
language*: cstring
|
language*: cstring
|
||||||
platform*: cstring
|
platform*: cstring
|
||||||
userAgent*: cstring
|
userAgent*: cstring
|
||||||
javaEnabled*: proc (): bool {.nimcall.}
|
|
||||||
mimeTypes*: seq[ref TMimeType]
|
mimeTypes*: seq[ref TMimeType]
|
||||||
|
|
||||||
TPlugin* {.importc.} = object of RootObj
|
TPlugin* {.importc.} = object of RootObj
|
||||||
|
|
@ -441,7 +355,8 @@ type
|
||||||
TToolBar* = TLocationBar
|
TToolBar* = TLocationBar
|
||||||
TStatusBar* = TLocationBar
|
TStatusBar* = TLocationBar
|
||||||
|
|
||||||
TScreen* {.importc.} = object of RootObj
|
Screen = ref ScreenObj
|
||||||
|
ScreenObj {.importc.} = object of RootObj
|
||||||
availHeight*: int
|
availHeight*: int
|
||||||
availWidth*: int
|
availWidth*: int
|
||||||
colorDepth*: int
|
colorDepth*: int
|
||||||
|
|
@ -452,11 +367,127 @@ type
|
||||||
TTimeOut* {.importc.} = object of RootObj
|
TTimeOut* {.importc.} = object of RootObj
|
||||||
TInterval* {.importc.} = object of RootObj
|
TInterval* {.importc.} = object of RootObj
|
||||||
|
|
||||||
|
{.push importcpp.}
|
||||||
|
|
||||||
|
# EventTarget "methods"
|
||||||
|
proc addEventListener*(et: EventTarget, ev: cstring, cb: proc(ev: Event), useCapture: bool = false)
|
||||||
|
|
||||||
|
# Window "methods"
|
||||||
|
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 setTimeout*(w: Window, code: cstring, pause: int): ref TTimeOut
|
||||||
|
proc stop*(w: Window)
|
||||||
|
|
||||||
|
# Node "methods"
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Document "methods"
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Element "methods"
|
||||||
|
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]
|
||||||
|
|
||||||
|
# FormElement "methods"
|
||||||
|
proc reset*(f: FormElement)
|
||||||
|
proc submit*(f: FormElement)
|
||||||
|
|
||||||
|
# EmbedElement "methods"
|
||||||
|
proc play*(e: EmbedElement)
|
||||||
|
proc stop*(e: EmbedElement)
|
||||||
|
|
||||||
|
# Location "methods"
|
||||||
|
proc reload*(loc: Location)
|
||||||
|
proc replace*(loc: Location, s: cstring)
|
||||||
|
|
||||||
|
# History "methods"
|
||||||
|
proc back*(h: History)
|
||||||
|
proc forward*(h: History)
|
||||||
|
proc go*(h: History, pagesToJump: int)
|
||||||
|
|
||||||
|
# Navigator "methods"
|
||||||
|
proc javaEnabled*(h: Navigator): bool
|
||||||
|
|
||||||
|
# ClassList "methods"
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Style "methods"
|
||||||
|
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)
|
||||||
|
|
||||||
|
{.pop.}
|
||||||
|
|
||||||
var
|
var
|
||||||
window* {.importc, nodecl.}: Window
|
window* {.importc, nodecl.}: Window
|
||||||
document* {.importc, nodecl.}: Document
|
document* {.importc, nodecl.}: Document
|
||||||
navigator* {.importc, nodecl.}: ref TNavigator
|
navigator* {.importc, nodecl.}: Navigator
|
||||||
screen* {.importc, nodecl.}: ref TScreen
|
screen* {.importc, nodecl.}: Screen
|
||||||
|
|
||||||
proc decodeURI*(uri: cstring): cstring {.importc, nodecl.}
|
proc decodeURI*(uri: cstring): cstring {.importc, nodecl.}
|
||||||
proc encodeURI*(uri: cstring): cstring {.importc, nodecl.}
|
proc encodeURI*(uri: cstring): cstring {.importc, nodecl.}
|
||||||
|
|
@ -474,6 +505,7 @@ proc parseInt*(s: cstring, radix: int):int {.importc, nodecl.}
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TEventHandlers* {.deprecated.} = EventTargetObj
|
||||||
TWindow* {.deprecated.} = WindowObj
|
TWindow* {.deprecated.} = WindowObj
|
||||||
TFrame* {.deprecated.} = FrameObj
|
TFrame* {.deprecated.} = FrameObj
|
||||||
TNode* {.deprecated.} = NodeObj
|
TNode* {.deprecated.} = NodeObj
|
||||||
|
|
@ -485,3 +517,11 @@ type
|
||||||
TOption* {.deprecated.} = OptionObj
|
TOption* {.deprecated.} = OptionObj
|
||||||
TForm* {.deprecated.} = FormObj
|
TForm* {.deprecated.} = FormObj
|
||||||
TImage* {.deprecated.} = ImageObj
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue