Document.hx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\Document.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `Document` interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree.`HTMLElement`
  26. Documentation [Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Document$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/Document>
  28. **/
  29. @:native("Document")
  30. extern class Document extends Node {
  31. /**
  32. Returns the DOM implementation associated with the current document.
  33. **/
  34. var implementation(default,null) : DOMImplementation;
  35. /**
  36. Returns the document location as a string.
  37. **/
  38. var URL(default,null) : String;
  39. /**
  40. Returns the document location as a string.
  41. **/
  42. var documentURI(default,null) : String;
  43. /**
  44. Indicates whether the document is rendered in quirks or strict mode.
  45. **/
  46. var compatMode(default,null) : String;
  47. /**
  48. Returns the character set being used by the document.
  49. **/
  50. var characterSet(default,null) : String;
  51. /**
  52. Alias of `Document.characterSet`. Use this property instead.
  53. **/
  54. var charset(default,null) : String;
  55. /**
  56. Alias of `Document.characterSet`. Use this property instead.
  57. **/
  58. var inputEncoding(default,null) : String;
  59. /**
  60. Returns the Content-Type from the MIME Header of the current document.
  61. **/
  62. var contentType(default,null) : String;
  63. /**
  64. Returns the Document Type Definition (DTD) of the current document.
  65. **/
  66. var doctype(default,null) : DocumentType;
  67. /**
  68. Returns the `Element` that is a direct child of the document. For HTML documents, this is normally the `HTMLElement` element.
  69. **/
  70. var documentElement(default,null) : Element;
  71. /**
  72. Returns the URI of the current document.
  73. **/
  74. var location(default,null) : Location;
  75. /**
  76. Returns the URI of the page that linked to this page.
  77. **/
  78. var referrer(default,null) : String;
  79. /**
  80. Returns the date on which the document was last modified.
  81. **/
  82. var lastModified(default,null) : String;
  83. /**
  84. Returns loading status of the document.
  85. **/
  86. var readyState(default,null) : String;
  87. /**
  88. Sets or gets the title of the current document.
  89. **/
  90. var title : String;
  91. /**
  92. Gets/sets directionality (rtl/ltr) of the document.
  93. **/
  94. var dir : String;
  95. /**
  96. Returns the `body` or `frameset` node of the current document.
  97. **/
  98. var body : Element;
  99. /**
  100. Returns the `head` element of the current document.
  101. **/
  102. var head(default,null) : HeadElement;
  103. /**
  104. Returns a list of the images in the current document.
  105. **/
  106. var images(default,null) : HTMLCollection;
  107. /**
  108. Returns a list of the embedded `embed` elements within the current document.
  109. **/
  110. var embeds(default,null) : HTMLCollection;
  111. /**
  112. Returns a list of the available plugins.
  113. **/
  114. var plugins(default,null) : HTMLCollection;
  115. /**
  116. Returns a list of all the hyperlinks in the document.
  117. **/
  118. var links(default,null) : HTMLCollection;
  119. /**
  120. Returns a list of the `form` elements within the current document.
  121. **/
  122. var forms(default,null) : HTMLCollection;
  123. /**
  124. Returns all the `script` elements on the document.
  125. **/
  126. var scripts(default,null) : HTMLCollection;
  127. /**
  128. Returns a reference to the window object.
  129. **/
  130. var defaultView(default,null) : Window;
  131. /**
  132. Represents the event handling code for the `readystatechange` event.
  133. **/
  134. var onreadystatechange : haxe.Constraints.Function;
  135. /**
  136. Represents the event handling code for the `beforescriptexecute` event.
  137. **/
  138. var onbeforescriptexecute : haxe.Constraints.Function;
  139. /**
  140. Represents the event handling code for the `afterscriptexecute` event.
  141. **/
  142. var onafterscriptexecute : haxe.Constraints.Function;
  143. /**
  144. Is an `EventHandler` representing the code to be called when the `selectionchange` event is raised.
  145. **/
  146. var onselectionchange : haxe.Constraints.Function;
  147. var currentScript(default,null) : Element;
  148. /**
  149. Returns a list of all of the anchors in the document.
  150. **/
  151. var anchors(default,null) : HTMLCollection;
  152. /**
  153. Returns an ordered list of the applets within a document.
  154. **/
  155. var applets(default,null) : HTMLCollection;
  156. /**
  157. `true` when the document is in `Using_full-screen_mode`.
  158. **/
  159. var fullscreen(default,null) : Bool;
  160. var fullscreenEnabled(default,null) : Bool;
  161. /**
  162. Is an `EventHandler` representing the code to be called when the `fullscreenchange` event is raised.
  163. **/
  164. var onfullscreenchange : haxe.Constraints.Function;
  165. /**
  166. Is an `EventHandler` representing the code to be called when the `fullscreenerror` event is raised.
  167. **/
  168. var onfullscreenerror : haxe.Constraints.Function;
  169. /**
  170. Represents the event handling code for the `pointerlockchange` event.
  171. **/
  172. var onpointerlockchange : haxe.Constraints.Function;
  173. /**
  174. Represents the event handling code for the `pointerlockerror` event.
  175. **/
  176. var onpointerlockerror : haxe.Constraints.Function;
  177. /**
  178. **/
  179. var hidden(default,null) : Bool;
  180. /**
  181. Returns a `string` denoting the visibility state of the document. Possible values are `visible`,  `hidden`,  `prerender`, and `unloaded`.
  182. **/
  183. var visibilityState(default,null) : VisibilityState;
  184. /**
  185. Is an `EventHandler` representing the code to be called when the `visibilitychange` event is raised.
  186. **/
  187. var onvisibilitychange : haxe.Constraints.Function;
  188. /**
  189. Returns which style sheet set is currently in use.
  190. **/
  191. var selectedStyleSheetSet : String;
  192. /**
  193. Returns the name of the style sheet set that was last enabled. Has the value `null` until the style sheet is changed by setting the value of `document.selectedStyleSheetSet`.
  194. **/
  195. var lastStyleSheetSet(default,null) : String;
  196. /**
  197. Returns the preferred style sheet set as specified by the page author.
  198. **/
  199. var preferredStyleSheetSet(default,null) : String;
  200. /**
  201. Returns a list of the style sheet sets available on the document.
  202. **/
  203. var styleSheetSets(default,null) : DOMStringList;
  204. /**
  205. Returns a reference to the `Element` that scrolls the document.
  206. **/
  207. var scrollingElement(default,null) : Element;
  208. /**
  209. **/
  210. var timeline(default,null) : DocumentTimeline;
  211. var rootElement(default,null) : js.html.svg.SVGElement;
  212. /**
  213. Represents the event handling code for the `copy` event.
  214. **/
  215. var oncopy : haxe.Constraints.Function;
  216. /**
  217. Represents the event handling code for the `cut` event.
  218. **/
  219. var oncut : haxe.Constraints.Function;
  220. /**
  221. Represents the event handling code for the `paste` event.
  222. **/
  223. var onpaste : haxe.Constraints.Function;
  224. var activeElement(default,null) : Element;
  225. var styleSheets(default,null) : StyleSheetList;
  226. var pointerLockElement(default,null) : Element;
  227. /**
  228. The element that's currently in full screen mode for this document.
  229. **/
  230. var fullscreenElement(default,null) : Element;
  231. var fonts(default,null) : FontFaceSet;
  232. var onabort : haxe.Constraints.Function;
  233. var onblur : haxe.Constraints.Function;
  234. var onfocus : haxe.Constraints.Function;
  235. var onauxclick : haxe.Constraints.Function;
  236. var oncanplay : haxe.Constraints.Function;
  237. var oncanplaythrough : haxe.Constraints.Function;
  238. var onchange : haxe.Constraints.Function;
  239. var onclick : haxe.Constraints.Function;
  240. var onclose : haxe.Constraints.Function;
  241. var oncontextmenu : haxe.Constraints.Function;
  242. var ondblclick : haxe.Constraints.Function;
  243. var ondrag : haxe.Constraints.Function;
  244. var ondragend : haxe.Constraints.Function;
  245. var ondragenter : haxe.Constraints.Function;
  246. var ondragexit : haxe.Constraints.Function;
  247. var ondragleave : haxe.Constraints.Function;
  248. var ondragover : haxe.Constraints.Function;
  249. var ondragstart : haxe.Constraints.Function;
  250. var ondrop : haxe.Constraints.Function;
  251. var ondurationchange : haxe.Constraints.Function;
  252. var onemptied : haxe.Constraints.Function;
  253. var onended : haxe.Constraints.Function;
  254. var oninput : haxe.Constraints.Function;
  255. var oninvalid : haxe.Constraints.Function;
  256. var onkeydown : haxe.Constraints.Function;
  257. var onkeypress : haxe.Constraints.Function;
  258. var onkeyup : haxe.Constraints.Function;
  259. var onload : haxe.Constraints.Function;
  260. var onloadeddata : haxe.Constraints.Function;
  261. var onloadedmetadata : haxe.Constraints.Function;
  262. var onloadend : haxe.Constraints.Function;
  263. var onloadstart : haxe.Constraints.Function;
  264. var onmousedown : haxe.Constraints.Function;
  265. var onmouseenter : haxe.Constraints.Function;
  266. var onmouseleave : haxe.Constraints.Function;
  267. var onmousemove : haxe.Constraints.Function;
  268. var onmouseout : haxe.Constraints.Function;
  269. var onmouseover : haxe.Constraints.Function;
  270. var onmouseup : haxe.Constraints.Function;
  271. /**
  272. Represents the event handling code for the `wheel` event.
  273. **/
  274. var onwheel : haxe.Constraints.Function;
  275. var onpause : haxe.Constraints.Function;
  276. var onplay : haxe.Constraints.Function;
  277. var onplaying : haxe.Constraints.Function;
  278. var onprogress : haxe.Constraints.Function;
  279. var onratechange : haxe.Constraints.Function;
  280. var onreset : haxe.Constraints.Function;
  281. var onresize : haxe.Constraints.Function;
  282. var onscroll : haxe.Constraints.Function;
  283. var onseeked : haxe.Constraints.Function;
  284. var onseeking : haxe.Constraints.Function;
  285. var onselect : haxe.Constraints.Function;
  286. var onshow : haxe.Constraints.Function;
  287. var onstalled : haxe.Constraints.Function;
  288. var onsubmit : haxe.Constraints.Function;
  289. var onsuspend : haxe.Constraints.Function;
  290. var ontimeupdate : haxe.Constraints.Function;
  291. var onvolumechange : haxe.Constraints.Function;
  292. var onwaiting : haxe.Constraints.Function;
  293. var onselectstart : haxe.Constraints.Function;
  294. var ontoggle : haxe.Constraints.Function;
  295. var onpointercancel : haxe.Constraints.Function;
  296. var onpointerdown : haxe.Constraints.Function;
  297. var onpointerup : haxe.Constraints.Function;
  298. var onpointermove : haxe.Constraints.Function;
  299. var onpointerout : haxe.Constraints.Function;
  300. var onpointerover : haxe.Constraints.Function;
  301. var onpointerenter : haxe.Constraints.Function;
  302. var onpointerleave : haxe.Constraints.Function;
  303. var ongotpointercapture : haxe.Constraints.Function;
  304. var onlostpointercapture : haxe.Constraints.Function;
  305. var onanimationcancel : haxe.Constraints.Function;
  306. var onanimationend : haxe.Constraints.Function;
  307. var onanimationiteration : haxe.Constraints.Function;
  308. var onanimationstart : haxe.Constraints.Function;
  309. var ontransitioncancel : haxe.Constraints.Function;
  310. var ontransitionend : haxe.Constraints.Function;
  311. var ontransitionrun : haxe.Constraints.Function;
  312. var ontransitionstart : haxe.Constraints.Function;
  313. var onwebkitanimationend : haxe.Constraints.Function;
  314. var onwebkitanimationiteration : haxe.Constraints.Function;
  315. var onwebkitanimationstart : haxe.Constraints.Function;
  316. var onwebkittransitionend : haxe.Constraints.Function;
  317. var onerror : haxe.Constraints.Function;
  318. var children(default,null) : HTMLCollection;
  319. var firstElementChild(default,null) : Element;
  320. var lastElementChild(default,null) : Element;
  321. var childElementCount(default,null) : Int;
  322. var ontouchstart : haxe.Constraints.Function;
  323. var ontouchend : haxe.Constraints.Function;
  324. var ontouchmove : haxe.Constraints.Function;
  325. var ontouchcancel : haxe.Constraints.Function;
  326. /** @throws DOMError */
  327. function new() : Void;
  328. /**
  329. Returns a list of elements with the given tag name.
  330. **/
  331. @:pure
  332. function getElementsByTagName( localName : String ) : HTMLCollection;
  333. /**
  334. Returns a list of elements with the given tag name and namespace.
  335. @throws DOMError
  336. **/
  337. @:pure
  338. function getElementsByTagNameNS( namespace : String, localName : String ) : HTMLCollection;
  339. /**
  340. Returns a list of elements with the given class name.
  341. **/
  342. @:pure
  343. function getElementsByClassName( classNames : String ) : HTMLCollection;
  344. @:pure
  345. function getElementById( elementId : String ) : Element;
  346. /**
  347. Creates a new element with the given tag name.
  348. @throws DOMError
  349. **/
  350. @:overload( function( localName : String, ?options : String) : Element {} )
  351. function createElement( localName : String, ?options : ElementCreationOptions ) : Element;
  352. /**
  353. Creates a new element with the given tag name and namespace URI.
  354. @throws DOMError
  355. **/
  356. @:overload( function( namespace : String, qualifiedName : String, ?options : String) : Element {} )
  357. function createElementNS( namespace : String, qualifiedName : String, ?options : ElementCreationOptions ) : Element;
  358. /**
  359. Creates a new document fragment.
  360. **/
  361. function createDocumentFragment() : DocumentFragment;
  362. /**
  363. Creates a text node.
  364. **/
  365. function createTextNode( data : String ) : Text;
  366. /**
  367. Creates a new comment node and returns it.
  368. **/
  369. function createComment( data : String ) : Comment;
  370. /**
  371. Creates a new `ProcessingInstruction` object.
  372. @throws DOMError
  373. **/
  374. function createProcessingInstruction( target : String, data : String ) : ProcessingInstruction;
  375. /**
  376. Returns a clone of a node from an external document.
  377. @throws DOMError
  378. **/
  379. function importNode( node : Node, deep : Bool = false ) : Node;
  380. /**
  381. Adopt node from an external document.
  382. @throws DOMError
  383. **/
  384. function adoptNode( node : Node ) : Node;
  385. /**
  386. Creates an event object.
  387. @throws DOMError
  388. **/
  389. function createEvent( interface_ : String ) : Event;
  390. /**
  391. Creates a `Range` object.
  392. @throws DOMError
  393. **/
  394. function createRange() : Range;
  395. /**
  396. Creates a `NodeIterator` object.
  397. @throws DOMError
  398. **/
  399. @:overload( function( root : Node, whatToShow : Int = cast 4294967295, ?filter : haxe.Constraints.Function) : NodeIterator {} )
  400. @:overload( function( root : Node, whatToShow : Int = cast 4294967295, ?filter : NodeFilter) : NodeIterator {} )
  401. function createNodeIterator( root : Node, whatToShow : Int = cast 4294967295, ?filter : Node -> Int ) : NodeIterator;
  402. /**
  403. Creates a `TreeWalker` object.
  404. @throws DOMError
  405. **/
  406. @:overload( function( root : Node, whatToShow : Int = cast 4294967295, ?filter : haxe.Constraints.Function) : TreeWalker {} )
  407. @:overload( function( root : Node, whatToShow : Int = cast 4294967295, ?filter : NodeFilter) : TreeWalker {} )
  408. function createTreeWalker( root : Node, whatToShow : Int = cast 4294967295, ?filter : Node -> Int ) : TreeWalker;
  409. /**
  410. Creates a new CDATA node and returns it.
  411. @throws DOMError
  412. **/
  413. function createCDATASection( data : String ) : CDATASection;
  414. /**
  415. Creates a new `Attr` object and returns it.
  416. @throws DOMError
  417. **/
  418. function createAttribute( name : String ) : Attr;
  419. /**
  420. Creates a new attribute node in a given namespace and returns it.
  421. @throws DOMError
  422. **/
  423. function createAttributeNS( namespace : String, name : String ) : Attr;
  424. @:pure
  425. function getElementsByName( elementName : String ) : NodeList;
  426. /**
  427. Returns `true` if the focus is currently located anywhere inside the specified document.
  428. @throws DOMError
  429. **/
  430. function hasFocus() : Bool;
  431. /**
  432. Releases the current mouse capture if it's on an element in this document.
  433. **/
  434. function releaseCapture() : Void;
  435. function exitFullscreen() : Void;
  436. /**
  437. Release the pointer lock.
  438. **/
  439. function exitPointerLock() : Void;
  440. /**
  441. Enables the style sheets for the specified style sheet set.
  442. **/
  443. function enableStyleSheetsForSet( name : String ) : Void;
  444. function caretPositionFromPoint( x : Float, y : Float ) : CaretPosition;
  445. /** @throws DOMError */
  446. @:pure
  447. function querySelector( selectors : String ) : Element;
  448. /** @throws DOMError */
  449. @:pure
  450. function querySelectorAll( selectors : String ) : NodeList;
  451. /**
  452. Returns an array of all `Animation` objects currently in effect, whose target elements are descendants of the `document`.
  453. **/
  454. function getAnimations() : Array<Animation>;
  455. /**
  456. Creates a `Touch` object.
  457. **/
  458. function createTouch( ?view : Window, ?target : EventTarget, identifier : Int = 0, pageX : Int = 0, pageY : Int = 0, screenX : Int = 0, screenY : Int = 0, clientX : Int = 0, clientY : Int = 0, radiusX : Int = 0, radiusY : Int = 0, rotationAngle : Float = 0.0, force : Float = 0.0 ) : Touch;
  459. /**
  460. Creates a `TouchList` object.
  461. **/
  462. @:overload( function( touch : Touch, touches : haxe.extern.Rest<Touch> ) : TouchList {} )
  463. @:overload( function() : TouchList {} )
  464. function createTouchList( touches : Array<Touch> ) : TouchList;
  465. /** @throws DOMError */
  466. function getSelection() : Selection;
  467. function elementFromPoint( x : Float, y : Float ) : Element;
  468. function elementsFromPoint( x : Float, y : Float ) : Array<Element>;
  469. /** @throws DOMError */
  470. @:overload( function( quad : DOMQuad, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  471. @:overload( function( quad : DOMQuad, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  472. function convertQuadFromNode( quad : DOMQuad, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  473. /** @throws DOMError */
  474. @:overload( function( rect : DOMRectReadOnly, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  475. @:overload( function( rect : DOMRectReadOnly, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  476. function convertRectFromNode( rect : DOMRectReadOnly, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  477. /** @throws DOMError */
  478. @:overload( function( point : DOMPointInit, from : Element, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  479. @:overload( function( point : DOMPointInit, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  480. function convertPointFromNode( point : DOMPointInit, from : Text, ?options : ConvertCoordinateOptions ) : DOMPoint;
  481. /** @throws DOMError */
  482. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  483. function prepend( nodes : haxe.extern.Rest<Node> ) : Void;
  484. /** @throws DOMError */
  485. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  486. function append( nodes : haxe.extern.Rest<Node> ) : Void;
  487. /** @throws DOMError */
  488. @:overload( function( expression : String, ?resolver : haxe.Constraints.Function) : XPathExpression {} )
  489. @:overload( function( expression : String, ?resolver : XPathNSResolver) : XPathExpression {} )
  490. function createExpression( expression : String, ?resolver : String -> Null<String> ) : XPathExpression;
  491. @:pure
  492. function createNSResolver( nodeResolver : Node ) : Node;
  493. /** @throws DOMError */
  494. @:overload( function( expression : String, contextNode : Node, ?resolver : haxe.Constraints.Function, type : Int = 0, ?result : Dynamic) : XPathResult {} )
  495. @:overload( function( expression : String, contextNode : Node, ?resolver : XPathNSResolver, type : Int = 0, ?result : Dynamic) : XPathResult {} )
  496. function evaluate( expression : String, contextNode : Node, ?resolver : String -> Null<String>, type : Int = 0, ?result : Dynamic ) : XPathResult;
  497. }