dom.nim 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2012 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. ## Declaration of the Document Object Model for the `JavaScript backend
  10. ## <backends.html#backends-the-javascript-target>`_.
  11. ##
  12. ##
  13. ## Document Ready
  14. ## --------------
  15. ##
  16. ## * Basic example of a document ready:
  17. runnableExamples"-b:js -r:off":
  18. proc example(e: Event) = echo "Document is ready"
  19. document.addEventListener("DOMContentLoaded", example) # You can also use "load" event.
  20. ## * This example runs 5 seconds after the document ready:
  21. runnableExamples"-b:js -r:off":
  22. proc example() = echo "5 seconds after document ready"
  23. proc domReady(e: Event) = discard setTimeout(example, 5_000) # Document is ready.
  24. document.addEventListener("DOMContentLoaded", domReady)
  25. ## Document onUnload
  26. ## -----------------
  27. ##
  28. ## * Simple example of how to implement code that runs when the page unloads:
  29. runnableExamples"-b:js -r:off":
  30. proc example(e: Event) = echo "Document is unloaded"
  31. document.addEventListener("unload", example) # You can also use "beforeunload".
  32. ## Document Autorefresh
  33. ## --------------------
  34. ##
  35. ## * Minimal example of a document autorefresh:
  36. runnableExamples"-b:js -r:off":
  37. proc example() = window.location.reload()
  38. discard setTimeout(example, 5_000)
  39. ## - For more examples, see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
  40. import std/private/since
  41. when not defined(js):
  42. {.error: "This module only works on the JavaScript platform".}
  43. const
  44. DomApiVersion* = 3 ## the version of DOM API we try to follow. No guarantees though.
  45. type
  46. EventTarget* {.importc.} = ref object of RootObj
  47. onabort*: proc (event: Event) {.closure.}
  48. onblur*: proc (event: Event) {.closure.}
  49. onchange*: proc (event: Event) {.closure.}
  50. onclick*: proc (event: Event) {.closure.}
  51. ondblclick*: proc (event: Event) {.closure.}
  52. onerror*: proc (event: Event) {.closure.}
  53. onfocus*: proc (event: Event) {.closure.}
  54. onkeydown*: proc (event: Event) {.closure.}
  55. onkeypress*: proc (event: Event) {.closure.}
  56. onkeyup*: proc (event: Event) {.closure.}
  57. onload*: proc (event: Event) {.closure.}
  58. onmousedown*: proc (event: Event) {.closure.}
  59. onmousemove*: proc (event: Event) {.closure.}
  60. onmouseout*: proc (event: Event) {.closure.}
  61. onmouseover*: proc (event: Event) {.closure.}
  62. onmouseup*: proc (event: Event) {.closure.}
  63. onreset*: proc (event: Event) {.closure.}
  64. onselect*: proc (event: Event) {.closure.}
  65. onstorage*: proc (event: Event) {.closure.}
  66. onsubmit*: proc (event: Event) {.closure.}
  67. onunload*: proc (event: Event) {.closure.}
  68. onloadstart*: proc (event: Event) {.closure.}
  69. onprogress*: proc (event: Event) {.closure.}
  70. onloadend*: proc (event: Event) {.closure.}
  71. DomEvent* {.pure.} = enum
  72. ## see `docs<https://developer.mozilla.org/en-US/docs/Web/Events>`_
  73. Abort = "abort",
  74. BeforeInput = "beforeinput",
  75. Blur = "blur",
  76. Click = "click",
  77. CompositionEnd = "compositionend",
  78. CompositionStart = "compositionstart",
  79. CompositionUpdate = "compositionupdate",
  80. DblClick = "dblclick",
  81. Error = "error",
  82. Focus = "focus",
  83. FocusIn = "focusin",
  84. FocusOut = "focusout",
  85. Input = "input",
  86. KeyDown = "keydown",
  87. KeyPress = "keypress",
  88. KeyUp = "keyup",
  89. Load = "load",
  90. MouseDown = "mousedown",
  91. MouseEnter = "mouseenter",
  92. MouseLeave = "mouseleave",
  93. MouseMove = "mousemove",
  94. MouseOut = "mouseout",
  95. MouseOver = "mouseover",
  96. MouseUp = "mouseup",
  97. Resize = "resize",
  98. Scroll = "scroll",
  99. Select = "select",
  100. Storage = "storage",
  101. Unload = "unload",
  102. Wheel = "wheel"
  103. PerformanceMemory* {.importc.} = ref object
  104. jsHeapSizeLimit*: float
  105. totalJSHeapSize*: float
  106. usedJSHeapSize*: float
  107. PerformanceTiming* {.importc.} = ref object
  108. connectStart*: float
  109. domComplete*: float
  110. domContentLoadedEventEnd*: float
  111. domContentLoadedEventStart*: float
  112. domInteractive*: float
  113. domLoading*: float
  114. domainLookupEnd*: float
  115. domainLookupStart*: float
  116. fetchStart*: float
  117. loadEventEnd*: float
  118. loadEventStart*: float
  119. navigationStart*: float
  120. redirectEnd*: float
  121. redirectStart*: float
  122. requestStart*: float
  123. responseEnd*: float
  124. responseStart*: float
  125. secureConnectionStart*: float
  126. unloadEventEnd*: float
  127. unloadEventStart*: float
  128. Performance* {.importc.} = ref object
  129. memory*: PerformanceMemory
  130. timing*: PerformanceTiming
  131. Range* {.importc.} = ref object
  132. ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Range>`_
  133. collapsed*: bool
  134. commonAncestorContainer*: Node
  135. endContainer*: Node
  136. endOffset*: int
  137. startContainer*: Node
  138. startOffset*: int
  139. Selection* {.importc.} = ref object
  140. ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Selection>`_
  141. anchorNode*: Node
  142. anchorOffset*: int
  143. focusNode*: Node
  144. focusOffset*: int
  145. isCollapsed*: bool
  146. rangeCount*: int
  147. `type`*: cstring
  148. Storage* {.importc.} = ref object
  149. Window* {.importc.} = ref object of EventTarget
  150. document*: Document
  151. event*: Event
  152. history*: History
  153. location*: Location
  154. closed*: bool
  155. defaultStatus*: cstring
  156. devicePixelRatio*: float
  157. innerHeight*, innerWidth*: int
  158. locationbar*: ref LocationBar
  159. menubar*: ref MenuBar
  160. name*: cstring
  161. outerHeight*, outerWidth*: int
  162. pageXOffset*, pageYOffset*: int
  163. scrollX*: float
  164. scrollY*: float
  165. personalbar*: ref PersonalBar
  166. scrollbars*: ref ScrollBars
  167. statusbar*: ref StatusBar
  168. status*: cstring
  169. toolbar*: ref ToolBar
  170. frames*: seq[Frame]
  171. screen*: Screen
  172. performance*: Performance
  173. onpopstate*: proc (event: Event)
  174. localStorage*: Storage
  175. sessionStorage*: Storage
  176. parent*: Window
  177. Frame* {.importc.} = ref object of Window
  178. ClassList* {.importc.} = ref object of RootObj
  179. NodeType* = enum
  180. ElementNode = 1,
  181. AttributeNode,
  182. TextNode,
  183. CDATANode,
  184. EntityRefNode,
  185. EntityNode,
  186. ProcessingInstructionNode,
  187. CommentNode,
  188. DocumentNode,
  189. DocumentTypeNode,
  190. DocumentFragmentNode,
  191. NotationNode
  192. Node* {.importc.} = ref object of EventTarget
  193. attributes*: seq[Node]
  194. childNodes*: seq[Node]
  195. children*: seq[Node]
  196. data*: cstring
  197. firstChild*: Node
  198. lastChild*: Node
  199. nextSibling*: Node
  200. nodeName*: cstring
  201. nodeType*: NodeType
  202. nodeValue*: cstring
  203. parentNode*: Node
  204. content*: Node
  205. previousSibling*: Node
  206. ownerDocument*: Document
  207. innerHTML*: cstring
  208. outerHTML*: cstring
  209. innerText*: cstring
  210. textContent*: cstring
  211. style*: Style
  212. baseURI*: cstring
  213. parentElement*: Element
  214. isConnected*: bool
  215. Document* {.importc.} = ref object of Node
  216. activeElement*: Element
  217. documentElement*: Element
  218. alinkColor*: cstring
  219. bgColor*: cstring
  220. body*: Element
  221. charset*: cstring
  222. cookie*: cstring
  223. defaultCharset*: cstring
  224. fgColor*: cstring
  225. head*: Element
  226. hidden*: bool
  227. lastModified*: cstring
  228. linkColor*: cstring
  229. referrer*: cstring
  230. title*: cstring
  231. URL*: cstring
  232. visibilityState*: cstring
  233. vlinkColor*: cstring
  234. anchors*: seq[AnchorElement]
  235. forms*: seq[FormElement]
  236. images*: seq[ImageElement]
  237. applets*: seq[Element]
  238. embeds*: seq[EmbedElement]
  239. links*: seq[LinkElement]
  240. fonts*: FontFaceSet
  241. Element* {.importc.} = ref object of Node
  242. className*: cstring
  243. classList*: ClassList
  244. checked*: bool
  245. defaultChecked*: bool
  246. defaultValue*: cstring
  247. disabled*: bool
  248. form*: FormElement
  249. name*: cstring
  250. readOnly*: bool
  251. options*: seq[OptionElement]
  252. selectedOptions*: seq[OptionElement]
  253. clientWidth*, clientHeight*: int
  254. contentEditable*: cstring
  255. isContentEditable*: bool
  256. dir*: cstring
  257. offsetHeight*: int
  258. offsetWidth*: int
  259. offsetLeft*: int
  260. offsetTop*: int
  261. ValidityState* {.importc.} = ref object ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/ValidityState>`_
  262. badInput*: bool
  263. customError*: bool
  264. patternMismatch*: bool
  265. rangeOverflow*: bool
  266. rangeUnderflow*: bool
  267. stepMismatch*: bool
  268. tooLong*: bool
  269. tooShort*: bool
  270. typeMismatch*: bool
  271. valid*: bool
  272. valueMissing*: bool
  273. Blob* {.importc.} = ref object of RootObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Blob>`_
  274. size*: int
  275. `type`*: cstring
  276. File* {.importc.} = ref object of Blob ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/File>`_
  277. lastModified*: int
  278. name*: cstring
  279. TextAreaElement* {.importc.} = ref object of Element ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement>`_
  280. value*: cstring
  281. selectionStart*, selectionEnd*: int
  282. selectionDirection*: cstring
  283. rows*, cols*: int
  284. InputElement* {.importc.} = ref object of Element ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement>`_
  285. # Properties related to the parent form
  286. formAction*: cstring
  287. formEncType*: cstring
  288. formMethod*: cstring
  289. formNoValidate*: bool
  290. formTarget*: cstring
  291. # Properties that apply to any type of input element that is not hidden
  292. `type`*: cstring
  293. autofocus*: bool
  294. required*: bool
  295. value*: cstring
  296. validity*: ValidityState
  297. validationMessage*: cstring
  298. willValidate*: bool
  299. # Properties that apply only to elements of type "checkbox" or "radio"
  300. indeterminate*: bool
  301. # Properties that apply only to elements of type "image"
  302. alt*: cstring
  303. height*: cstring
  304. src*: cstring
  305. width*: cstring
  306. # Properties that apply only to elements of type "file"
  307. accept*: cstring
  308. files*: seq[Blob]
  309. # Properties that apply only to text/number-containing or elements
  310. autocomplete*: cstring
  311. maxLength*: int
  312. size*: int
  313. pattern*: cstring
  314. placeholder*: cstring
  315. min*: cstring
  316. max*: cstring
  317. selectionStart*: int
  318. selectionEnd*: int
  319. selectionDirection*: cstring
  320. # Properties not yet categorized
  321. dirName*: cstring
  322. accessKey*: cstring
  323. list*: Element
  324. multiple*: bool
  325. labels*: seq[Element]
  326. step*: cstring
  327. valueAsDate*: cstring
  328. valueAsNumber*: float
  329. LinkElement* {.importc.} = ref object of Element
  330. target*: cstring
  331. text*: cstring
  332. x*: int
  333. y*: int
  334. EmbedElement* {.importc.} = ref object of Element
  335. height*: int
  336. hspace*: int
  337. src*: cstring
  338. width*: int
  339. `type`*: cstring
  340. vspace*: int
  341. AnchorElement* {.importc.} = ref object of Element
  342. text*: cstring
  343. x*, y*: int
  344. OptionElement* {.importc.} = ref object of Element
  345. defaultSelected*: bool
  346. selected*: bool
  347. selectedIndex*: int
  348. text*: cstring
  349. value*: cstring
  350. FormElement* {.importc.} = ref object of Element ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement>`_
  351. acceptCharset*: cstring
  352. action*: cstring
  353. autocomplete*: cstring
  354. elements*: seq[Element]
  355. encoding*: cstring
  356. enctype*: cstring
  357. length*: int
  358. `method`*: cstring
  359. noValidate*: bool
  360. target*: cstring
  361. ImageElement* {.importc.} = ref object of Element
  362. border*: int
  363. complete*: bool
  364. height*: int
  365. hspace*: int
  366. lowsrc*: cstring
  367. src*: cstring
  368. vspace*: int
  369. width*: int
  370. Style* {.importc.} = ref object of RootObj
  371. alignContent*: cstring
  372. alignItems*: cstring
  373. alignSelf*: cstring
  374. all*: cstring
  375. animation*: cstring
  376. animationDelay*: cstring
  377. animationDirection*: cstring
  378. animationDuration*: cstring
  379. animationFillMode*: cstring
  380. animationIterationCount*: cstring
  381. animationName*: cstring
  382. animationPlayState*: cstring
  383. animationTimingFunction*: cstring
  384. backdropFilter*: cstring
  385. backfaceVisibility*: cstring
  386. background*: cstring
  387. backgroundAttachment*: cstring
  388. backgroundBlendMode*: cstring
  389. backgroundClip*: cstring
  390. backgroundColor*: cstring
  391. backgroundImage*: cstring
  392. backgroundOrigin*: cstring
  393. backgroundPosition*: cstring
  394. backgroundRepeat*: cstring
  395. backgroundSize*: cstring
  396. blockSize*: cstring
  397. border*: cstring
  398. borderBlock*: cstring
  399. borderBlockColor*: cstring
  400. borderBlockEnd*: cstring
  401. borderBlockEndColor*: cstring
  402. borderBlockEndStyle*: cstring
  403. borderBlockEndWidth*: cstring
  404. borderBlockStart*: cstring
  405. borderBlockStartColor*: cstring
  406. borderBlockStartStyle*: cstring
  407. borderBlockStartWidth*: cstring
  408. borderBlockStyle*: cstring
  409. borderBlockWidth*: cstring
  410. borderBottom*: cstring
  411. borderBottomColor*: cstring
  412. borderBottomLeftRadius*: cstring
  413. borderBottomRightRadius*: cstring
  414. borderBottomStyle*: cstring
  415. borderBottomWidth*: cstring
  416. borderCollapse*: cstring
  417. borderColor*: cstring
  418. borderEndEndRadius*: cstring
  419. borderEndStartRadius*: cstring
  420. borderImage*: cstring
  421. borderImageOutset*: cstring
  422. borderImageRepeat*: cstring
  423. borderImageSlice*: cstring
  424. borderImageSource*: cstring
  425. borderImageWidth*: cstring
  426. borderInline*: cstring
  427. borderInlineColor*: cstring
  428. borderInlineEnd*: cstring
  429. borderInlineEndColor*: cstring
  430. borderInlineEndStyle*: cstring
  431. borderInlineEndWidth*: cstring
  432. borderInlineStart*: cstring
  433. borderInlineStartColor*: cstring
  434. borderInlineStartStyle*: cstring
  435. borderInlineStartWidth*: cstring
  436. borderInlineStyle*: cstring
  437. borderInlineWidth*: cstring
  438. borderLeft*: cstring
  439. borderLeftColor*: cstring
  440. borderLeftStyle*: cstring
  441. borderLeftWidth*: cstring
  442. borderRadius*: cstring
  443. borderRight*: cstring
  444. borderRightColor*: cstring
  445. borderRightStyle*: cstring
  446. borderRightWidth*: cstring
  447. borderSpacing*: cstring
  448. borderStartEndRadius*: cstring
  449. borderStartStartRadius*: cstring
  450. borderStyle*: cstring
  451. borderTop*: cstring
  452. borderTopColor*: cstring
  453. borderTopLeftRadius*: cstring
  454. borderTopRightRadius*: cstring
  455. borderTopStyle*: cstring
  456. borderTopWidth*: cstring
  457. borderWidth*: cstring
  458. bottom*: cstring
  459. boxDecorationBreak*: cstring
  460. boxShadow*: cstring
  461. boxSizing*: cstring
  462. breakAfter*: cstring
  463. breakBefore*: cstring
  464. breakInside*: cstring
  465. captionSide*: cstring
  466. caretColor*: cstring
  467. clear*: cstring
  468. clip*: cstring
  469. clipPath*: cstring
  470. color*: cstring
  471. colorAdjust*: cstring
  472. columnCount*: cstring
  473. columnFill*: cstring
  474. columnGap*: cstring
  475. columnRule*: cstring
  476. columnRuleColor*: cstring
  477. columnRuleStyle*: cstring
  478. columnRuleWidth*: cstring
  479. columnSpan*: cstring
  480. columnWidth*: cstring
  481. columns*: cstring
  482. contain*: cstring
  483. content*: cstring
  484. counterIncrement*: cstring
  485. counterReset*: cstring
  486. counterSet*: cstring
  487. cursor*: cstring
  488. direction*: cstring
  489. display*: cstring
  490. emptyCells*: cstring
  491. filter*: cstring
  492. flex*: cstring
  493. flexBasis*: cstring
  494. flexDirection*: cstring
  495. flexFlow*: cstring
  496. flexGrow*: cstring
  497. flexShrink*: cstring
  498. flexWrap*: cstring
  499. cssFloat*: cstring
  500. font*: cstring
  501. fontFamily*: cstring
  502. fontFeatureSettings*: cstring
  503. fontKerning*: cstring
  504. fontLanguageOverride*: cstring
  505. fontOpticalSizing*: cstring
  506. fontSize*: cstring
  507. fontSizeAdjust*: cstring
  508. fontStretch*: cstring
  509. fontStyle*: cstring
  510. fontSynthesis*: cstring
  511. fontVariant*: cstring
  512. fontVariantAlternates*: cstring
  513. fontVariantCaps*: cstring
  514. fontVariantEastAsian*: cstring
  515. fontVariantLigatures*: cstring
  516. fontVariantNumeric*: cstring
  517. fontVariantPosition*: cstring
  518. fontVariationSettings*: cstring
  519. fontWeight*: cstring
  520. gap*: cstring
  521. grid*: cstring
  522. gridArea*: cstring
  523. gridAutoColumns*: cstring
  524. gridAutoFlow*: cstring
  525. gridAutoRows*: cstring
  526. gridColumn*: cstring
  527. gridColumnEnd*: cstring
  528. gridColumnStart*: cstring
  529. gridRow*: cstring
  530. gridRowEnd*: cstring
  531. gridRowStart*: cstring
  532. gridTemplate*: cstring
  533. gridTemplateAreas*: cstring
  534. gridTemplateColumns*: cstring
  535. gridTemplateRows*: cstring
  536. hangingPunctuation*: cstring
  537. height*: cstring
  538. hyphens*: cstring
  539. imageOrientation*: cstring
  540. imageRendering*: cstring
  541. inlineSize*: cstring
  542. inset*: cstring
  543. insetBlock*: cstring
  544. insetBlockEnd*: cstring
  545. insetBlockStart*: cstring
  546. insetInline*: cstring
  547. insetInlineEnd*: cstring
  548. insetInlineStart*: cstring
  549. isolation*: cstring
  550. justifyContent*: cstring
  551. justifyItems*: cstring
  552. justifySelf*: cstring
  553. left*: cstring
  554. letterSpacing*: cstring
  555. lineBreak*: cstring
  556. lineHeight*: cstring
  557. listStyle*: cstring
  558. listStyleImage*: cstring
  559. listStylePosition*: cstring
  560. listStyleType*: cstring
  561. margin*: cstring
  562. marginBlock*: cstring
  563. marginBlockEnd*: cstring
  564. marginBlockStart*: cstring
  565. marginBottom*: cstring
  566. marginInline*: cstring
  567. marginInlineEnd*: cstring
  568. marginInlineStart*: cstring
  569. marginLeft*: cstring
  570. marginRight*: cstring
  571. marginTop*: cstring
  572. mask*: cstring
  573. maskBorder*: cstring
  574. maskBorderMode*: cstring
  575. maskBorderOutset*: cstring
  576. maskBorderRepeat*: cstring
  577. maskBorderSlice*: cstring
  578. maskBorderSource*: cstring
  579. maskBorderWidth*: cstring
  580. maskClip*: cstring
  581. maskComposite*: cstring
  582. maskImage*: cstring
  583. maskMode*: cstring
  584. maskOrigin*: cstring
  585. maskPosition*: cstring
  586. maskRepeat*: cstring
  587. maskSize*: cstring
  588. maskType*: cstring
  589. maxBlockSize*: cstring
  590. maxHeight*: cstring
  591. maxInlineSize*: cstring
  592. maxWidth*: cstring
  593. minBlockSize*: cstring
  594. minHeight*: cstring
  595. minInlineSize*: cstring
  596. minWidth*: cstring
  597. mixBlendMode*: cstring
  598. objectFit*: cstring
  599. objectPosition*: cstring
  600. offset*: cstring
  601. offsetAnchor*: cstring
  602. offsetDistance*: cstring
  603. offsetPath*: cstring
  604. offsetRotate*: cstring
  605. opacity*: cstring
  606. order*: cstring
  607. orphans*: cstring
  608. outline*: cstring
  609. outlineColor*: cstring
  610. outlineOffset*: cstring
  611. outlineStyle*: cstring
  612. outlineWidth*: cstring
  613. overflow*: cstring
  614. overflowAnchor*: cstring
  615. overflowBlock*: cstring
  616. overflowInline*: cstring
  617. overflowWrap*: cstring
  618. overflowX*: cstring
  619. overflowY*: cstring
  620. overscrollBehavior*: cstring
  621. overscrollBehaviorBlock*: cstring
  622. overscrollBehaviorInline*: cstring
  623. overscrollBehaviorX*: cstring
  624. overscrollBehaviorY*: cstring
  625. padding*: cstring
  626. paddingBlock*: cstring
  627. paddingBlockEnd*: cstring
  628. paddingBlockStart*: cstring
  629. paddingBottom*: cstring
  630. paddingInline*: cstring
  631. paddingInlineEnd*: cstring
  632. paddingInlineStart*: cstring
  633. paddingLeft*: cstring
  634. paddingRight*: cstring
  635. paddingTop*: cstring
  636. pageBreakAfter*: cstring
  637. pageBreakBefore*: cstring
  638. pageBreakInside*: cstring
  639. paintOrder*: cstring
  640. perspective*: cstring
  641. perspectiveOrigin*: cstring
  642. placeContent*: cstring
  643. placeItems*: cstring
  644. placeSelf*: cstring
  645. pointerEvents*: cstring
  646. position*: cstring
  647. quotes*: cstring
  648. resize*: cstring
  649. right*: cstring
  650. rotate*: cstring
  651. rowGap*: cstring
  652. scale*: cstring
  653. scrollBehavior*: cstring
  654. scrollMargin*: cstring
  655. scrollMarginBlock*: cstring
  656. scrollMarginBlockEnd*: cstring
  657. scrollMarginBlockStart*: cstring
  658. scrollMarginBottom*: cstring
  659. scrollMarginInline*: cstring
  660. scrollMarginInlineEnd*: cstring
  661. scrollMarginInlineStart*: cstring
  662. scrollMarginLeft*: cstring
  663. scrollMarginRight*: cstring
  664. scrollMarginTop*: cstring
  665. scrollPadding*: cstring
  666. scrollPaddingBlock*: cstring
  667. scrollPaddingBlockEnd*: cstring
  668. scrollPaddingBlockStart*: cstring
  669. scrollPaddingBottom*: cstring
  670. scrollPaddingInline*: cstring
  671. scrollPaddingInlineEnd*: cstring
  672. scrollPaddingInlineStart*: cstring
  673. scrollPaddingLeft*: cstring
  674. scrollPaddingRight*: cstring
  675. scrollPaddingTop*: cstring
  676. scrollSnapAlign*: cstring
  677. scrollSnapStop*: cstring
  678. scrollSnapType*: cstring
  679. scrollbar3dLightColor*: cstring
  680. scrollbarArrowColor*: cstring
  681. scrollbarBaseColor*: cstring
  682. scrollbarColor*: cstring
  683. scrollbarDarkshadowColor*: cstring
  684. scrollbarFaceColor*: cstring
  685. scrollbarHighlightColor*: cstring
  686. scrollbarShadowColor*: cstring
  687. scrollbarTrackColor*: cstring
  688. scrollbarWidth*: cstring
  689. shapeImageThreshold*: cstring
  690. shapeMargin*: cstring
  691. shapeOutside*: cstring
  692. tabSize*: cstring
  693. tableLayout*: cstring
  694. textAlign*: cstring
  695. textAlignLast*: cstring
  696. textCombineUpright*: cstring
  697. textDecoration*: cstring
  698. textDecorationColor*: cstring
  699. textDecorationLine*: cstring
  700. textDecorationSkipInk*: cstring
  701. textDecorationStyle*: cstring
  702. textDecorationThickness*: cstring
  703. textEmphasis*: cstring
  704. textEmphasisColor*: cstring
  705. textEmphasisPosition*: cstring
  706. textEmphasisStyle*: cstring
  707. textIndent*: cstring
  708. textJustify*: cstring
  709. textOrientation*: cstring
  710. textOverflow*: cstring
  711. textRendering*: cstring
  712. textShadow*: cstring
  713. textTransform*: cstring
  714. textUnderlineOffset*: cstring
  715. textUnderlinePosition*: cstring
  716. top*: cstring
  717. touchAction*: cstring
  718. transform*: cstring
  719. transformBox*: cstring
  720. transformOrigin*: cstring
  721. transformStyle*: cstring
  722. transition*: cstring
  723. transitionDelay*: cstring
  724. transitionDuration*: cstring
  725. transitionProperty*: cstring
  726. transitionTimingFunction*: cstring
  727. translate*: cstring
  728. unicodeBidi*: cstring
  729. verticalAlign*: cstring
  730. visibility*: cstring
  731. whiteSpace*: cstring
  732. widows*: cstring
  733. width*: cstring
  734. willChange*: cstring
  735. wordBreak*: cstring
  736. wordSpacing*: cstring
  737. writingMode*: cstring
  738. zIndex*: cstring
  739. EventPhase* = enum
  740. None = 0,
  741. CapturingPhase,
  742. AtTarget,
  743. BubblingPhase
  744. Event* {.importc.} = ref object of RootObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Event>`_
  745. bubbles*: bool
  746. cancelBubble*: bool
  747. cancelable*: bool
  748. composed*: bool
  749. currentTarget*: Node
  750. defaultPrevented*: bool
  751. eventPhase*: int
  752. target*: Node
  753. `type`*: cstring
  754. isTrusted*: bool
  755. UIEvent* {.importc.} = ref object of Event ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/UIEvent>`_
  756. detail*: int64
  757. view*: Window
  758. KeyboardEvent* {.importc.} = ref object of UIEvent ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent>`_
  759. altKey*, ctrlKey*, metaKey*, shiftKey*: bool
  760. code*: cstring
  761. isComposing*: bool
  762. key*: cstring
  763. keyCode*: int
  764. location*: int
  765. KeyboardEventKey* {.pure.} = enum ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values>`_
  766. # Modifier keys
  767. Alt,
  768. AltGraph,
  769. CapsLock,
  770. Control,
  771. Fn,
  772. FnLock,
  773. Hyper,
  774. Meta,
  775. NumLock,
  776. ScrollLock,
  777. Shift,
  778. Super,
  779. Symbol,
  780. SymbolLock,
  781. # Whitespace keys
  782. ArrowDown,
  783. ArrowLeft,
  784. ArrowRight,
  785. ArrowUp,
  786. End,
  787. Home,
  788. PageDown,
  789. PageUp,
  790. # Editing keys
  791. Backspace,
  792. Clear,
  793. Copy,
  794. CrSel,
  795. Cut,
  796. Delete,
  797. EraseEof,
  798. ExSel,
  799. Insert,
  800. Paste,
  801. Redo,
  802. Undo,
  803. # UI keys
  804. Accept,
  805. Again,
  806. Attn,
  807. Cancel,
  808. ContextMenu,
  809. Escape,
  810. Execute,
  811. Find,
  812. Finish,
  813. Help,
  814. Pause,
  815. Play,
  816. Props,
  817. Select,
  818. ZoomIn,
  819. ZoomOut,
  820. # Device keys
  821. BrigtnessDown,
  822. BrigtnessUp,
  823. Eject,
  824. LogOff,
  825. Power,
  826. PowerOff,
  827. PrintScreen,
  828. Hibernate,
  829. Standby,
  830. WakeUp,
  831. # Common IME keys
  832. AllCandidates,
  833. Alphanumeric,
  834. CodeInput,
  835. Compose,
  836. Convert,
  837. Dead,
  838. FinalMode,
  839. GroupFirst,
  840. GroupLast,
  841. GroupNext,
  842. GroupPrevious,
  843. ModeChange,
  844. NextCandidate,
  845. NonConvert,
  846. PreviousCandidate,
  847. Process,
  848. SingleCandidate,
  849. # Korean keyboards only
  850. HangulMode,
  851. HanjaMode,
  852. JunjaMode,
  853. # Japanese keyboards only
  854. Eisu,
  855. Hankaku,
  856. Hiragana,
  857. HiraganaKatakana,
  858. KanaMode,
  859. KanjiMode,
  860. Katakana,
  861. Romaji,
  862. Zenkaku,
  863. ZenkakuHanaku,
  864. # Function keys
  865. F1,
  866. F2,
  867. F3,
  868. F4,
  869. F5,
  870. F6,
  871. F7,
  872. F8,
  873. F9,
  874. F10,
  875. F11,
  876. F12,
  877. F13,
  878. F14,
  879. F15,
  880. F16,
  881. F17,
  882. F18,
  883. F19,
  884. F20,
  885. Soft1,
  886. Soft2,
  887. Soft3,
  888. Soft4,
  889. # Phone keys
  890. AppSwitch,
  891. Call,
  892. Camera,
  893. CameraFocus,
  894. EndCall,
  895. GoBack,
  896. GoHome,
  897. HeadsetHook,
  898. LastNumberRedial,
  899. Notification,
  900. MannerMode,
  901. VoiceDial,
  902. # Multimedia keys
  903. ChannelDown,
  904. ChannelUp,
  905. MediaFastForward,
  906. MediaPause,
  907. MediaPlay,
  908. MediaPlayPause,
  909. MediaRecord,
  910. MediaRewind,
  911. MediaStop,
  912. MediaTrackNext,
  913. MediaTrackPrevious,
  914. # Audio control keys
  915. AudioBalanceLeft,
  916. AudioBalanceRight,
  917. AudioBassDown,
  918. AudioBassBoostDown,
  919. AudioBassBoostToggle,
  920. AudioBassBoostUp,
  921. AudioBassUp,
  922. AudioFaderFront,
  923. AudioFaderRear,
  924. AudioSurroundModeNext,
  925. AudioTrebleDown,
  926. AudioTrebleUp,
  927. AudioVolumeDown,
  928. AUdioVolumeMute,
  929. AudioVolumeUp,
  930. MicrophoneToggle,
  931. MicrophoneVolumeDown,
  932. MicrophoneVolumeMute,
  933. MicrophoneVolumeUp,
  934. # TV control keys
  935. TV,
  936. TV3DMode,
  937. TVAntennaCable,
  938. TVAudioDescription,
  939. TVAudioDescriptionMixDown,
  940. TVAudioDescriptionMixUp,
  941. TVContentsMenu,
  942. TVDataService,
  943. TVInput,
  944. TVInputComponent1,
  945. TVInputComponent2,
  946. TVInputComposite1,
  947. TVInputComposite2,
  948. TVInputHDMI1,
  949. TVInputHDMI2,
  950. TVInputHDMI3,
  951. TVInputHDMI4,
  952. TVInputVGA1,
  953. TVMediaContext,
  954. TVNetwork,
  955. TVNumberEntry,
  956. TVPower,
  957. TVRadioService,
  958. TVSatellite,
  959. TVSatelliteBS,
  960. TVSatelliteCS,
  961. TVSatelliteToggle,
  962. TVTerrestrialAnalog,
  963. TVTerrestrialDigital,
  964. TVTimer,
  965. # Media controller keys
  966. AVRInput,
  967. AVRPower,
  968. ColorF0Red,
  969. ColorF1Green,
  970. ColorF2Yellow,
  971. ColorF3Blue,
  972. ColorF4Grey,
  973. ColorF5Brown,
  974. ClosedCaptionToggle,
  975. Dimmer,
  976. DisplaySwap,
  977. DVR,
  978. Exit,
  979. FavoriteClear0,
  980. FavoriteClear1,
  981. FavoriteClear2,
  982. FavoriteClear3,
  983. FavoriteRecall0,
  984. FavoriteRecall1,
  985. FavoriteRecall2,
  986. FavoriteRecall3,
  987. FavoriteStore0,
  988. FavoriteStore1,
  989. FavoriteStore2,
  990. FavoriteStore3,
  991. Guide,
  992. GuideNextDay,
  993. GuidePreviousDay,
  994. Info,
  995. InstantReplay,
  996. Link,
  997. ListProgram,
  998. LiveContent,
  999. Lock,
  1000. MediaApps,
  1001. MediaAudioTrack,
  1002. MediaLast,
  1003. MediaSkipBackward,
  1004. MediaSkipForward,
  1005. MediaStepBackward,
  1006. MediaStepForward,
  1007. MediaTopMenu,
  1008. NavigateIn,
  1009. NavigateNext,
  1010. NavigateOut,
  1011. NavigatePrevious,
  1012. NextFavoriteChannel,
  1013. NextUserProfile,
  1014. OnDemand,
  1015. Pairing,
  1016. PinPDown,
  1017. PinPMove,
  1018. PinPUp,
  1019. PlaySpeedDown,
  1020. PlaySpeedReset,
  1021. PlaySpeedUp,
  1022. RandomToggle,
  1023. RcLowBattery,
  1024. RecordSpeedNext,
  1025. RfBypass,
  1026. ScanChannelsToggle,
  1027. ScreenModeNext,
  1028. Settings,
  1029. SplitScreenToggle,
  1030. STBInput,
  1031. STBPower,
  1032. Subtitle,
  1033. Teletext,
  1034. VideoModeNext,
  1035. Wink,
  1036. ZoomToggle,
  1037. # Speech recognition keys
  1038. SpeechCorrectionList,
  1039. SpeechInputToggle,
  1040. # Document keys
  1041. Close,
  1042. New,
  1043. Open,
  1044. Print,
  1045. Save,
  1046. SpellCheck,
  1047. MailForward,
  1048. MailReply,
  1049. MailSend,
  1050. # Application selector keys
  1051. LaunchCalculator,
  1052. LaunchCalendar,
  1053. LaunchContacts,
  1054. LaunchMail,
  1055. LaunchMediaPlayer,
  1056. LaunchMusicPlayer,
  1057. LaunchMyComputer,
  1058. LaunchPhone,
  1059. LaunchScreenSaver,
  1060. LaunchSpreadsheet,
  1061. LaunchWebBrowser,
  1062. LaunchWebCam,
  1063. LaunchWordProcessor,
  1064. LaunchApplication1,
  1065. LaunchApplication2,
  1066. LaunchApplication3,
  1067. LaunchApplication4,
  1068. LaunchApplication5,
  1069. LaunchApplication6,
  1070. LaunchApplication7,
  1071. LaunchApplication8,
  1072. LaunchApplication9,
  1073. LaunchApplication10,
  1074. LaunchApplication11,
  1075. LaunchApplication12,
  1076. LaunchApplication13,
  1077. LaunchApplication14,
  1078. LaunchApplication15,
  1079. LaunchApplication16,
  1080. # Browser control keys
  1081. BrowserBack,
  1082. BrowserFavorites,
  1083. BrowserForward,
  1084. BrowserHome,
  1085. BrowserRefresh,
  1086. BrowserSearch,
  1087. BrowserStop,
  1088. # Numeric keypad keys
  1089. Key11,
  1090. Key12,
  1091. Separator
  1092. MouseButtons* = enum
  1093. NoButton = 0,
  1094. PrimaryButton = 1,
  1095. SecondaryButton = 2,
  1096. AuxilaryButton = 4,
  1097. FourthButton = 8,
  1098. FifthButton = 16
  1099. MouseEvent* {.importc.} = ref object of UIEvent ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent>`_
  1100. altKey*, ctrlKey*, metaKey*, shiftKey*: bool
  1101. button*: int
  1102. buttons*: int
  1103. clientX*, clientY*: int
  1104. movementX*, movementY*: int
  1105. offsetX*, offsetY*: int
  1106. pageX*, pageY*: int
  1107. relatedTarget*: EventTarget
  1108. #region*: cstring
  1109. screenX*, screenY*: int
  1110. x*, y*: int
  1111. DataTransferItemKind* {.pure.} = enum
  1112. File = "file",
  1113. String = "string"
  1114. DataTransferItem* {.importc.} = ref object of RootObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem>`_
  1115. kind*: cstring
  1116. `type`*: cstring
  1117. DataTransfer* {.importc.} = ref object of RootObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer>`_
  1118. dropEffect*: cstring
  1119. effectAllowed*: cstring
  1120. files*: seq[Element]
  1121. items*: seq[DataTransferItem]
  1122. types*: seq[cstring]
  1123. DataTransferDropEffect* {.pure.} = enum
  1124. None = "none",
  1125. Copy = "copy",
  1126. Link = "link",
  1127. Move = "move"
  1128. DataTransferEffectAllowed* {.pure.} = enum
  1129. None = "none",
  1130. Copy = "copy",
  1131. CopyLink = "copyLink",
  1132. CopyMove = "copyMove",
  1133. Link = "link",
  1134. LinkMove = "linkMove",
  1135. Move = "move",
  1136. All = "all",
  1137. Uninitialized = "uninitialized"
  1138. DragEventTypes* = enum
  1139. Drag = "drag",
  1140. DragEnd = "dragend",
  1141. DragEnter = "dragenter",
  1142. DragExit = "dragexit",
  1143. DragLeave = "dragleave",
  1144. DragOver = "dragover",
  1145. DragStart = "dragstart",
  1146. Drop = "drop"
  1147. DragEvent* {.importc.} = object of MouseEvent
  1148. ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DragEvent>`_
  1149. dataTransfer*: DataTransfer
  1150. ClipboardEvent* {.importc.} = object of Event
  1151. ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent>`_
  1152. clipboardData*: DataTransfer
  1153. StorageEvent* {.importc.} = ref object of Event ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent>`_
  1154. key*: cstring
  1155. newValue*, oldValue*: cstring
  1156. storageArea*: Storage
  1157. url*: cstring
  1158. TouchList* {.importc.} = ref object of RootObj
  1159. length*: int
  1160. Touch* {.importc.} = ref object of RootObj
  1161. identifier*: int
  1162. screenX*, screenY*, clientX*, clientY*, pageX*, pageY*: int
  1163. target*: Element
  1164. radiusX*, radiusY*: int
  1165. rotationAngle*: int
  1166. force*: float
  1167. TouchEvent* {.importc.} = ref object of UIEvent
  1168. changedTouches*, targetTouches*, touches*: seq[Touch]
  1169. Location* {.importc.} = ref object of RootObj
  1170. hash*: cstring
  1171. host*: cstring
  1172. hostname*: cstring
  1173. href*: cstring
  1174. pathname*: cstring
  1175. port*: cstring
  1176. protocol*: cstring
  1177. search*: cstring
  1178. origin*: cstring
  1179. History* {.importc.} = ref object of RootObj
  1180. length*: int
  1181. Navigator* {.importc.} = ref object of RootObj
  1182. appCodeName*: cstring
  1183. appName*: cstring
  1184. appVersion*: cstring
  1185. buildID*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/buildID
  1186. cookieEnabled*: bool
  1187. deviceMemory*: float ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory
  1188. doNotTrack*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack
  1189. language*: cstring
  1190. languages*: seq[cstring] ## https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/languages
  1191. maxTouchPoints*: cint ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/maxTouchPoints
  1192. onLine*: bool ## https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine
  1193. oscpu*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu
  1194. platform*: cstring
  1195. userAgent*: cstring
  1196. vendor*: cstring ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vendor
  1197. webdriver*: bool ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver
  1198. mimeTypes*: seq[ref MimeType]
  1199. Plugin* {.importc.} = object of RootObj
  1200. description*: cstring
  1201. filename*: cstring
  1202. name*: cstring
  1203. MimeType* {.importc.} = object of RootObj
  1204. description*: cstring
  1205. enabledPlugin*: ref Plugin
  1206. suffixes*: seq[cstring]
  1207. `type`*: cstring
  1208. LocationBar* {.importc.} = object of RootObj
  1209. visible*: bool
  1210. MenuBar* = LocationBar
  1211. PersonalBar* = LocationBar
  1212. ScrollBars* = LocationBar
  1213. ToolBar* = LocationBar
  1214. StatusBar* = LocationBar
  1215. Screen* {.importc.} = ref object of RootObj
  1216. availHeight*: int
  1217. availWidth*: int
  1218. colorDepth*: int
  1219. height*: int
  1220. pixelDepth*: int
  1221. width*: int
  1222. TimeOut* {.importc.} = ref object of RootObj
  1223. Interval* {.importc.} = ref object of RootObj
  1224. AddEventListenerOptions* = object
  1225. capture*: bool
  1226. once*: bool
  1227. passive*: bool
  1228. FontFaceSetReady* {.importc.} = ref object
  1229. ## see: `docs<https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/ready>`_
  1230. then*: proc(cb: proc())
  1231. FontFaceSet* {.importc.} = ref object
  1232. ## see: `docs<https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet>`_
  1233. ready*: FontFaceSetReady
  1234. onloadingdone*: proc(event: Event)
  1235. ScrollIntoViewOptions* = object
  1236. behavior*: cstring
  1237. `block`*: cstring
  1238. inline*: cstring
  1239. MediaQueryList* {.importc.} = ref object of EventTarget
  1240. matches*: bool
  1241. media*: cstring
  1242. since (1, 3):
  1243. type
  1244. DomParser* = ref object
  1245. ## DOM Parser object (defined on browser only, may not be on NodeJS).
  1246. ## * https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
  1247. ##
  1248. ## ```nim
  1249. ## let prsr = newDomParser()
  1250. ## discard prsr.parseFromString("<html><marquee>Hello World</marquee></html>".cstring, "text/html".cstring)
  1251. ## ```
  1252. DomException* {.importc.} = ref object
  1253. ## The DOMException interface represents an abnormal event (called an exception)
  1254. ## which occurs as a result of calling a method or accessing a property of a web API.
  1255. ## Each exception has a name, which is a short "CamelCase" style string identifying
  1256. ## the error or abnormal condition.
  1257. ## https://developer.mozilla.org/en-US/docs/Web/API/DOMException
  1258. FileReader* {.importc.} = ref object of EventTarget
  1259. ## The FileReader object lets web applications asynchronously read the contents of files
  1260. ## (or raw data buffers) stored on the user's computer, using File or Blob objects to specify
  1261. ## the file or data to read.
  1262. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader
  1263. FileReaderState* = distinct range[0'u16..2'u16]
  1264. RootNodeOptions* = object of RootObj
  1265. composed*: bool
  1266. DocumentOrShadowRoot* {.importc.} = object of RootObj
  1267. activeElement*: Element
  1268. # styleSheets*: StyleSheetList
  1269. ShadowRoot* {.importc.} = ref object of DocumentOrShadowRoot
  1270. delegatesFocus*: bool
  1271. host*: Element
  1272. innerHTML*: cstring
  1273. mode*: cstring # "open" or "closed"
  1274. ShadowRootInit* = object of RootObj
  1275. mode*: cstring
  1276. delegatesFocus*: bool
  1277. HTMLSlotElement* {.importc.} = ref object of RootObj
  1278. name*: cstring
  1279. SlotOptions* = object of RootObj
  1280. flatten*: bool
  1281. const
  1282. fileReaderEmpty* = 0.FileReaderState
  1283. fileReaderLoading* = 1.FileReaderState
  1284. fileReaderDone* = 2.FileReaderState
  1285. proc id*(n: Node): cstring {.importcpp: "#.id", nodecl.}
  1286. proc `id=`*(n: Node; x: cstring) {.importcpp: "#.id = #", nodecl.}
  1287. proc class*(n: Node): cstring {.importcpp: "#.className", nodecl.}
  1288. proc `class=`*(n: Node; v: cstring) {.importcpp: "#.className = #", nodecl.}
  1289. proc value*(n: Node): cstring {.importcpp: "#.value", nodecl.}
  1290. proc `value=`*(n: Node; v: cstring) {.importcpp: "#.value = #", nodecl.}
  1291. proc checked*(n: Node): bool {.importcpp: "#.checked", nodecl.}
  1292. proc `checked=`*(n: Node; v: bool) {.importcpp: "#.checked = #", nodecl.}
  1293. proc `disabled=`*(n: Node; v: bool) {.importcpp: "#.disabled = #", nodecl.}
  1294. when defined(nodejs):
  1295. # we provide a dummy DOM for nodejs for testing purposes
  1296. proc len*(x: Node): int = x.childNodes.len
  1297. proc `[]`*(x: Node; idx: int): Element =
  1298. assert idx >= 0 and idx < x.childNodes.len
  1299. result = cast[Element](x.childNodes[idx])
  1300. var document* = Document(nodeType: DocumentNode)
  1301. document.ownerDocument = document
  1302. proc getElem(x: Element; id: cstring): Element =
  1303. if x.id == id: return x
  1304. for i in 0..<x.len:
  1305. result = getElem(x[i], id)
  1306. if result != nil: return result
  1307. proc getElementById*(doc: Document; id: cstring): Element =
  1308. getElem(doc.body, id)
  1309. proc getElementById*(id: cstring): Element = document.getElementById(id)
  1310. proc appendChild*(parent, n: Node) =
  1311. n.parentNode = parent
  1312. n.ownerDocument = parent.ownerDocument
  1313. parent.childNodes.add n
  1314. proc replaceChild*(parent, newNode, oldNode: Node) =
  1315. newNode.parentNode = parent
  1316. oldNode.parentNode = nil
  1317. var i = 0
  1318. while i < parent.len:
  1319. if Node(parent[i]) == oldNode:
  1320. parent.childNodes[i] = newNode
  1321. return
  1322. inc i
  1323. doAssert false, "old node not in node list"
  1324. proc removeChild*(parent, child: Node) =
  1325. child.parentNode = nil
  1326. var i = 0
  1327. while i < parent.len:
  1328. if Node(parent[i]) == child:
  1329. parent.childNodes.delete(i)
  1330. return
  1331. inc i
  1332. doAssert false, "old node not in node list"
  1333. proc insertBefore*(parent, newNode, before: Node) =
  1334. appendChild(parent, newNode)
  1335. var i = 0
  1336. while i < parent.len-1:
  1337. if Node(parent[i]) == before:
  1338. for j in countdown(parent.len-1, i-1):
  1339. parent.childNodes[j] = parent.childNodes[j-1]
  1340. parent.childNodes[i-1] = newNode
  1341. return
  1342. inc i
  1343. #doAssert false, "before not in node list"
  1344. proc createElement*(d: Document, identifier: cstring): Element =
  1345. new(result)
  1346. result.nodeName = identifier
  1347. result.nodeType = NodeType.ElementNode
  1348. proc createTextNode*(d: Document, identifier: cstring): Node =
  1349. new(result)
  1350. result.nodeName = "#text"
  1351. result.nodeValue = identifier
  1352. result.nodeType = NodeType.TextNode
  1353. proc createComment*(d: Document, data: cstring): Node =
  1354. new(result)
  1355. result.nodeName = "#comment"
  1356. result.nodeValue = data
  1357. result.nodeType = NodeType.CommentNode
  1358. else:
  1359. proc len*(x: Node): int {.importcpp: "#.childNodes.length".}
  1360. proc `[]`*(x: Node; idx: int): Element {.importcpp: "#.childNodes[#]".}
  1361. proc getElementById*(id: cstring): Element {.importc: "document.getElementById", nodecl.}
  1362. proc appendChild*(n, child: Node) {.importcpp.}
  1363. proc removeChild*(n, child: Node) {.importcpp.}
  1364. proc remove*(child: Node) {.importcpp.}
  1365. proc replaceChild*(n, newNode, oldNode: Node) {.importcpp.}
  1366. proc insertBefore*(n, newNode, before: Node) {.importcpp.}
  1367. proc getElementById*(d: Document, id: cstring): Element {.importcpp.}
  1368. proc createElement*(d: Document, identifier: cstring): Element {.importcpp.}
  1369. proc createElementNS*(d: Document, namespaceURI, qualifiedIdentifier: cstring): Element {.importcpp.}
  1370. proc createTextNode*(d: Document, identifier: cstring): Node {.importcpp.}
  1371. proc createComment*(d: Document, data: cstring): Node {.importcpp.}
  1372. proc setTimeout*(action: proc(); ms: int): TimeOut {.importc, nodecl.}
  1373. proc clearTimeout*(t: TimeOut) {.importc, nodecl.}
  1374. proc setInterval*(action: proc(); ms: int): Interval {.importc, nodecl.}
  1375. proc clearInterval*(i: Interval) {.importc, nodecl.}
  1376. {.push importcpp.}
  1377. # EventTarget "methods"
  1378. proc addEventListener*(et: EventTarget, ev: cstring, cb: proc(ev: Event), useCapture: bool = false)
  1379. proc addEventListener*(et: EventTarget, ev: cstring, cb: proc(ev: Event), options: AddEventListenerOptions)
  1380. proc dispatchEvent*(et: EventTarget, ev: Event)
  1381. proc removeEventListener*(et: EventTarget; ev: cstring; cb: proc(ev: Event))
  1382. # Window "methods"
  1383. proc alert*(w: Window, msg: cstring)
  1384. proc back*(w: Window)
  1385. proc blur*(w: Window)
  1386. proc clearInterval*(w: Window, interval: Interval)
  1387. proc clearTimeout*(w: Window, timeout: TimeOut)
  1388. proc close*(w: Window)
  1389. proc confirm*(w: Window, msg: cstring): bool
  1390. proc disableExternalCapture*(w: Window)
  1391. proc enableExternalCapture*(w: Window)
  1392. proc find*(w: Window, text: cstring, caseSensitive = false,
  1393. backwards = false)
  1394. proc focus*(w: Window)
  1395. proc forward*(w: Window)
  1396. proc getComputedStyle*(w: Window, e: Node, pe: Node = nil): Style
  1397. ## .. warning:: The returned Style may or may not be read-only at run-time in the browser. getComputedStyle is performance costly.
  1398. proc handleEvent*(w: Window, e: Event)
  1399. proc home*(w: Window)
  1400. proc moveBy*(w: Window, x, y: int)
  1401. proc moveTo*(w: Window, x, y: int)
  1402. proc open*(w: Window, uri, windowname: cstring,
  1403. properties: cstring = nil): Window
  1404. proc print*(w: Window)
  1405. proc prompt*(w: Window, text, default: cstring): cstring
  1406. proc resizeBy*(w: Window, x, y: int)
  1407. proc resizeTo*(w: Window, x, y: int)
  1408. proc routeEvent*(w: Window, event: Event)
  1409. proc scrollBy*(w: Window, x, y: int)
  1410. proc scrollTo*(w: Window, x, y: int)
  1411. proc setInterval*(w: Window, code: cstring, pause: int): Interval
  1412. proc setInterval*(w: Window, function: proc (), pause: int): Interval
  1413. proc setTimeout*(w: Window, code: cstring, pause: int): TimeOut
  1414. proc setTimeout*(w: Window, function: proc (), pause: int): Interval
  1415. proc stop*(w: Window)
  1416. proc requestAnimationFrame*(w: Window, function: proc (time: float)): int
  1417. proc cancelAnimationFrame*(w: Window, id: int)
  1418. proc matchMedia*(w: Window, mediaQueryString: cstring): MediaQueryList
  1419. # Node "methods"
  1420. proc appendData*(n: Node, data: cstring)
  1421. proc cloneNode*(n: Node, copyContent: bool): Node
  1422. proc deleteData*(n: Node, start, len: int)
  1423. proc focus*(e: Node)
  1424. proc getAttribute*(n: Node, attr: cstring): cstring
  1425. proc getAttributeNode*(n: Node, attr: cstring): Node
  1426. proc hasAttribute*(n: Node, attr: cstring): bool
  1427. proc hasChildNodes*(n: Node): bool
  1428. proc normalize*(n: Node)
  1429. proc insertData*(n: Node, position: int, data: cstring)
  1430. proc removeAttribute*(n: Node, attr: cstring)
  1431. proc removeAttributeNode*(n, attr: Node)
  1432. proc replaceData*(n: Node, start, len: int, text: cstring)
  1433. proc scrollIntoView*(n: Node)
  1434. proc scrollIntoView*(n: Node, options: ScrollIntoViewOptions)
  1435. proc setAttribute*(n: Node, name, value: cstring)
  1436. proc setAttributeNode*(n: Node, attr: Node)
  1437. proc querySelector*(n: Node, selectors: cstring): Element
  1438. proc querySelectorAll*(n: Node, selectors: cstring): seq[Element]
  1439. proc compareDocumentPosition*(n: Node, otherNode:Node): int
  1440. proc lookupPrefix*(n: Node): cstring
  1441. proc lookupNamespaceURI*(n: Node): cstring
  1442. proc isDefaultNamespace*(n: Node): bool
  1443. proc contains*(n: Node): bool
  1444. proc isEqualNode*(n: Node): bool
  1445. proc isSameNode*(n: Node): bool
  1446. since (1, 3):
  1447. proc getRootNode*(n: Node,options: RootNodeOptions): Node
  1448. # DocumentOrShadowRoot
  1449. proc getSelection*(n: DocumentOrShadowRoot): Selection
  1450. proc elementFromPoint*(n: DocumentOrShadowRoot; x, y: float): Element
  1451. # shadow dom
  1452. proc attachShadow*(n: Element): ShadowRoot
  1453. proc assignedNodes*(n: HTMLSlotElement; options: SlotOptions): seq[Node]
  1454. proc assignedElements*(n: HTMLSlotElement; options: SlotOptions): seq[Element]
  1455. # Document "methods"
  1456. proc createAttribute*(d: Document, identifier: cstring): Node
  1457. proc getElementsByName*(d: Document, name: cstring): seq[Element]
  1458. proc getElementsByTagName*(d: Document, name: cstring): seq[Element]
  1459. proc getElementsByClassName*(d: Document, name: cstring): seq[Element]
  1460. proc insertNode*(range: Range, node: Node)
  1461. proc getSelection*(d: Document): Selection
  1462. proc handleEvent*(d: Document, event: Event)
  1463. proc open*(d: Document)
  1464. proc routeEvent*(d: Document, event: Event)
  1465. proc write*(d: Document, text: cstring)
  1466. proc writeln*(d: Document, text: cstring)
  1467. proc querySelector*(d: Document, selectors: cstring): Element
  1468. proc querySelectorAll*(d: Document, selectors: cstring): seq[Element]
  1469. # Element "methods"
  1470. proc blur*(e: Element)
  1471. proc click*(e: Element)
  1472. proc focus*(e: Element)
  1473. proc handleEvent*(e: Element, event: Event)
  1474. proc select*(e: Element)
  1475. proc getElementsByTagName*(e: Element, name: cstring): seq[Element]
  1476. proc getElementsByClassName*(e: Element, name: cstring): seq[Element]
  1477. # FormElement "methods"
  1478. proc reset*(f: FormElement)
  1479. proc submit*(f: FormElement)
  1480. proc checkValidity*(e: FormElement): bool
  1481. proc reportValidity*(e: FormElement): bool
  1482. # EmbedElement "methods"
  1483. proc play*(e: EmbedElement)
  1484. proc stop*(e: EmbedElement)
  1485. # Location "methods"
  1486. proc reload*(loc: Location)
  1487. proc replace*(loc: Location, s: cstring)
  1488. # History "methods"
  1489. proc back*(h: History)
  1490. proc forward*(h: History)
  1491. proc go*(h: History, pagesToJump: int)
  1492. proc pushState*[T](h: History, stateObject: T, title, url: cstring)
  1493. # Navigator "methods"
  1494. proc javaEnabled*(h: Navigator): bool
  1495. since (1, 3):
  1496. proc canShare*(self: Navigator; data: cstring): bool ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/canShare
  1497. proc sendBeacon*(self: Navigator; url, data: cstring): bool ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
  1498. proc vibrate*(self: Navigator; pattern: cint): bool ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate
  1499. proc vibrate*(self: Navigator; pattern: openArray[cint]): bool ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate
  1500. proc registerProtocolHandler*(self: Navigator; scheme, url, title: cstring) ## https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
  1501. # ClassList "methods"
  1502. proc add*(c: ClassList, class: cstring)
  1503. proc remove*(c: ClassList, class: cstring)
  1504. proc contains*(c: ClassList, class: cstring): bool
  1505. proc toggle*(c: ClassList, class: cstring)
  1506. # Style "methods"
  1507. proc getPropertyValue*(s: Style, property: cstring): cstring
  1508. proc removeProperty*(s: Style, property: cstring)
  1509. proc setProperty*(s: Style, property, value: cstring, priority = "")
  1510. proc getPropertyPriority*(s: Style, property: cstring): cstring
  1511. # Event "methods"
  1512. proc preventDefault*(ev: Event)
  1513. proc stopImmediatePropagation*(ev: Event)
  1514. proc stopPropagation*(ev: Event)
  1515. # KeyboardEvent "methods"
  1516. proc getModifierState*(ev: KeyboardEvent, keyArg: cstring): bool
  1517. # MouseEvent "methods"
  1518. proc getModifierState*(ev: MouseEvent, keyArg: cstring): bool
  1519. # TouchEvent "methods"
  1520. proc identifiedTouch*(list: TouchList): Touch
  1521. proc item*(list: TouchList, i: int): Touch
  1522. # DataTransfer "methods"
  1523. proc clearData*(dt: DataTransfer, format: cstring)
  1524. proc getData*(dt: DataTransfer, format: cstring): cstring
  1525. proc setData*(dt: DataTransfer, format: cstring, data: cstring)
  1526. proc setDragImage*(dt: DataTransfer, img: Element, xOffset: int64, yOffset: int64)
  1527. # DataTransferItem "methods"
  1528. proc getAsFile*(dti: DataTransferItem): File
  1529. # InputElement "methods"
  1530. proc setSelectionRange*(e: InputElement, selectionStart: int, selectionEnd: int, selectionDirection: cstring = "none")
  1531. proc setRangeText*(e: InputElement, replacement: cstring, startindex: int = 0, endindex: int = 0, selectionMode: cstring = "preserve")
  1532. proc setCustomValidity*(e: InputElement, error: cstring)
  1533. proc checkValidity*(e: InputElement): bool
  1534. # Blob "methods"
  1535. proc slice*(e: Blob, startindex: int = 0, endindex: int = e.size, contentType: cstring = "")
  1536. # Performance "methods"
  1537. proc now*(p: Performance): float
  1538. # Selection "methods"
  1539. proc removeAllRanges*(s: Selection)
  1540. proc deleteFromDocument*(s: Selection)
  1541. proc getRangeAt*(s: Selection, index: int): Range
  1542. converter toString*(s: Selection): cstring
  1543. proc `$`*(s: Selection): string = $(s.toString())
  1544. # Storage "methods"
  1545. proc getItem*(s: Storage, key: cstring): cstring
  1546. proc setItem*(s: Storage, key, value: cstring)
  1547. proc hasItem*(s: Storage, key: cstring): bool
  1548. proc clear*(s: Storage)
  1549. proc removeItem*(s: Storage, key: cstring)
  1550. {.pop.}
  1551. proc setAttr*(n: Node; key, val: cstring) {.importcpp: "#.setAttribute(@)".}
  1552. var
  1553. window* {.importc, nodecl.}: Window
  1554. navigator* {.importc, nodecl.}: Navigator
  1555. screen* {.importc, nodecl.}: Screen
  1556. when not defined(nodejs):
  1557. var document* {.importc, nodecl.}: Document
  1558. proc decodeURI*(uri: cstring): cstring {.importc, nodecl.}
  1559. proc encodeURI*(uri: cstring): cstring {.importc, nodecl.}
  1560. proc escape*(uri: cstring): cstring {.importc, nodecl.}
  1561. proc unescape*(uri: cstring): cstring {.importc, nodecl.}
  1562. proc decodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
  1563. proc encodeURIComponent*(uri: cstring): cstring {.importc, nodecl.}
  1564. proc isFinite*(x: BiggestFloat): bool {.importc, nodecl.}
  1565. proc isNaN*(x: BiggestFloat): bool {.importc, nodecl.}
  1566. ## see also `math.isNaN`.
  1567. proc newEvent*(name: cstring): Event {.importcpp: "new Event(@)", constructor.}
  1568. proc getElementsByClass*(n: Node; name: cstring): seq[Node] {.
  1569. importcpp: "#.getElementsByClassName(#)", nodecl.}
  1570. type
  1571. BoundingRect* {.importc.} = object
  1572. top*, bottom*, left*, right*, x*, y*, width*, height*: float
  1573. proc getBoundingClientRect*(e: Node): BoundingRect {.
  1574. importcpp: "getBoundingClientRect", nodecl.}
  1575. proc clientHeight*(): int {.
  1576. importcpp: "(window.innerHeight || document.documentElement.clientHeight)@", nodecl.}
  1577. proc clientWidth*(): int {.
  1578. importcpp: "(window.innerWidth || document.documentElement.clientWidth)@", nodecl.}
  1579. proc inViewport*(el: Node): bool =
  1580. let rect = el.getBoundingClientRect()
  1581. result = rect.top >= 0 and rect.left >= 0 and
  1582. rect.bottom <= clientHeight().float and
  1583. rect.right <= clientWidth().float
  1584. proc scrollTop*(e: Node): int {.importcpp: "#.scrollTop", nodecl.}
  1585. proc `scrollTop=`*(e: Node, value: int) {.importcpp: "#.scrollTop = #", nodecl.}
  1586. proc scrollLeft*(e: Node): int {.importcpp: "#.scrollLeft", nodecl.}
  1587. proc scrollHeight*(e: Node): int {.importcpp: "#.scrollHeight", nodecl.}
  1588. proc scrollWidth*(e: Node): int {.importcpp: "#.scrollWidth", nodecl.}
  1589. proc offsetHeight*(e: Node): int {.importcpp: "#.offsetHeight", nodecl.}
  1590. proc offsetWidth*(e: Node): int {.importcpp: "#.offsetWidth", nodecl.}
  1591. proc offsetTop*(e: Node): int {.importcpp: "#.offsetTop", nodecl.}
  1592. proc offsetLeft*(e: Node): int {.importcpp: "#.offsetLeft", nodecl.}
  1593. since (1, 3):
  1594. func newDomParser*(): DomParser {.importcpp: "new DOMParser()".}
  1595. ## DOM Parser constructor.
  1596. func parseFromString*(this: DomParser; str: cstring; mimeType: cstring): Document {.importcpp.}
  1597. ## Parse from string to `Document`.
  1598. proc newDomException*(): DomException {.importcpp: "new DomException()", constructor.}
  1599. ## DOM Exception constructor
  1600. proc message*(ex: DomException): cstring {.importcpp: "#.message", nodecl.}
  1601. ## https://developer.mozilla.org/en-US/docs/Web/API/DOMException/message
  1602. proc name*(ex: DomException): cstring {.importcpp: "#.name", nodecl.}
  1603. ## https://developer.mozilla.org/en-US/docs/Web/API/DOMException/name
  1604. proc newFileReader*(): FileReader {.importcpp: "new FileReader()", constructor.}
  1605. ## File Reader constructor
  1606. proc error*(f: FileReader): DomException {.importcpp: "#.error", nodecl.}
  1607. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/error
  1608. proc readyState*(f: FileReader): FileReaderState {.importcpp: "#.readyState", nodecl.}
  1609. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readyState
  1610. proc resultAsString*(f: FileReader): cstring {.importcpp: "#.result", nodecl.}
  1611. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
  1612. proc abort*(f: FileReader) {.importcpp: "#.abort()".}
  1613. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/abort
  1614. proc readAsBinaryString*(f: FileReader, b: Blob) {.importcpp: "#.readAsBinaryString(#)".}
  1615. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsBinaryString
  1616. proc readAsDataURL*(f: FileReader, b: Blob) {.importcpp: "#.readAsDataURL(#)".}
  1617. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
  1618. proc readAsText*(f: FileReader, b: Blob|File, encoding = cstring"UTF-8") {.importcpp: "#.readAsText(#, #)".}
  1619. ## https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsText
  1620. since (1, 5):
  1621. proc elementsFromPoint*(n: DocumentOrShadowRoot; x, y: float): seq[Element] {.importcpp.}
  1622. since (1, 7):
  1623. proc insertAdjacentText*(self: Node; position, data: cstring) {.importjs: "#.$1(#, #)".}
  1624. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText
  1625. proc insertAdjacentElement*(self: Node; position: cstring; element: Node) {.importjs: "#.$1(#, #)".}
  1626. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement
  1627. proc insertAdjacentHTML*(self: Node; position, html: cstring) {.importjs: "#.$1(#, #)".}
  1628. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
  1629. proc after*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
  1630. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/after
  1631. proc before*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
  1632. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/before
  1633. proc append*(self: Node; element: Node): Node {.importjs: "#.$1(@)", varargs.}
  1634. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/append
  1635. proc closest*(self: Node; cssSelector: cstring): Node {.importjs: "#.$1(#)".}
  1636. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
  1637. proc hasAttributeNS*(self: Node; namespace, localName: cstring): bool {.importjs: "(#.$1(#, #) || false)".}
  1638. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS
  1639. proc removeAttributeNS*(self: Node; namespace, attributeName: cstring) {.importjs: "#.$1(#, #)".}
  1640. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS
  1641. proc hasPointerCapture*(self: Node; pointerId: SomeNumber): bool {.importjs: "(#.$1(#) || false)".}
  1642. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture
  1643. proc releasePointerCapture*(self: Node; pointerId: SomeNumber) {.importjs: "#.$1(#)".}
  1644. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/releasePointerCapture
  1645. proc requestPointerLock*(self: Node) {.importjs: "#.$1()".}
  1646. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock
  1647. proc replaceChildren*(self: Node; replacements: Node) {.importjs: "#.$1(@)", varargs.}
  1648. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren
  1649. proc replaceWith*(self: Node; replacements: Node) {.importjs: "#.$1(@)", varargs.}
  1650. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith
  1651. proc scrollIntoViewIfNeeded*(self: Node; centerIfNeeded: bool) {.importjs: "#.$1(#)".}
  1652. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded
  1653. proc setHTML*(self: Node; html: cstring) {.importjs: "#.$1(#)".}
  1654. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/setHTML
  1655. proc toggleAttribute*(self: Node; name: cstring; force = false): bool {.importjs: "(#.$1(#, #) || false)".}
  1656. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute
  1657. proc matches*(self: Node; cssSelector: cstring): bool {.importjs: "(#.$1(#) || false)".}
  1658. ## https://developer.mozilla.org/en-US/docs/Web/API/Element/matches