Document.hx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. /*
  2. * Copyright (C)2005-2018 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. The DOM tree includes elements such as `body` and `table`, among many others. It provides functionality global to the document, like how to obtain the page's URL and create new elements in the document.
  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. /**
  33. Returns the DOM implementation associated with the current document.
  34. **/
  35. var implementation(default,null) : DOMImplementation;
  36. /**
  37. Returns the document location as a string.
  38. **/
  39. var URL(default,null) : String;
  40. /**
  41. Returns the document location as a string.
  42. **/
  43. var documentURI(default,null) : String;
  44. /**
  45. Indicates whether the document is rendered in quirks or strict mode.
  46. **/
  47. var compatMode(default,null) : String;
  48. /**
  49. Returns the character set being used by the document.
  50. **/
  51. var characterSet(default,null) : String;
  52. /**
  53. Alias of `Document.characterSet`. Use this property instead.
  54. **/
  55. var charset(default,null) : String;
  56. /**
  57. Alias of `Document.characterSet`. Use this property instead.
  58. **/
  59. var inputEncoding(default,null) : String;
  60. /**
  61. Returns the Content-Type from the MIME Header of the current document.
  62. **/
  63. var contentType(default,null) : String;
  64. /**
  65. Returns the Document Type Definition (DTD) of the current document.
  66. **/
  67. var doctype(default,null) : DocumentType;
  68. /**
  69. Returns the `Element` that is a direct child of the document. For HTML documents, this is normally the `html` element.
  70. **/
  71. var documentElement(default,null) : Element;
  72. /**
  73. Returns the URI of the current document.
  74. **/
  75. var location(default,null) : Location;
  76. /**
  77. Returns the URI of the page that linked to this page.
  78. **/
  79. var referrer(default,null) : String;
  80. /**
  81. Returns the date on which the document was last modified.
  82. **/
  83. var lastModified(default,null) : String;
  84. /**
  85. Returns loading status of the document.
  86. **/
  87. var readyState(default,null) : String;
  88. /**
  89. Sets or gets title of the current document.
  90. **/
  91. var title : String;
  92. /**
  93. Gets/sets directionality (rtl/ltr) of the document.
  94. **/
  95. var dir : String;
  96. /**
  97. Returns a reference to the window object.
  98. **/
  99. var defaultView(default,null) : Window;
  100. /**
  101. Returns the currently focused element.
  102. **/
  103. var activeElement(default,null) : Element;
  104. /**
  105. Represents the event handling code for the `readystatechange` event.
  106. **/
  107. var onreadystatechange : haxe.Constraints.Function;
  108. /**
  109. Represents the event handling code for the `wheel` event.
  110. **/
  111. var onwheel : haxe.Constraints.Function;
  112. /**
  113. Represents the event handling code for the `copy` event.
  114. **/
  115. var oncopy : haxe.Constraints.Function;
  116. /**
  117. Represents the event handling code for the `cut` event.
  118. **/
  119. var oncut : haxe.Constraints.Function;
  120. /**
  121. Represents the event handling code for the `paste` event.
  122. **/
  123. var onpaste : haxe.Constraints.Function;
  124. /**
  125. Represents the event handling code for the `beforescriptexecute` event.
  126. **/
  127. var onbeforescriptexecute : haxe.Constraints.Function;
  128. /**
  129. Represents the event handling code for the `afterscriptexecute` event.
  130. **/
  131. var onafterscriptexecute : haxe.Constraints.Function;
  132. var currentScript(default,null) : Element;
  133. var fullscreenEnabled(default,null) : Bool;
  134. var fullscreenElement(default,null) : Element;
  135. /**
  136. Returns the element set as the target for mouse events while the pointer is locked. `null` if lock is pending, pointer is unlocked, or if the target is in another document.
  137. **/
  138. var pointerLockElement(default,null) : Element;
  139. /**
  140. **/
  141. var hidden(default,null) : Bool;
  142. /**
  143. Returns a `string` denoting the visibility state of the document. Possible values are `visible`,  `hidden`,  `prerender`, and `unloaded`.
  144. **/
  145. var visibilityState(default,null) : VisibilityState;
  146. /**
  147. Returns a list of the style sheet objects on the current document.
  148. **/
  149. var styleSheets(default,null) : StyleSheetList;
  150. /**
  151. Returns which style sheet set is currently in use.
  152. **/
  153. var selectedStyleSheetSet : String;
  154. /**
  155. 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`.
  156. **/
  157. var lastStyleSheetSet(default,null) : String;
  158. /**
  159. Returns the preferred style sheet set as specified by the page author.
  160. **/
  161. var preferredStyleSheetSet(default,null) : String;
  162. /**
  163. Returns a list of the style sheet sets available on the document.
  164. **/
  165. var styleSheetSets(default,null) : DOMStringList;
  166. /**
  167. **/
  168. var timeline(default,null) : DocumentTimeline;
  169. var fonts(default,null) : FontFaceSet;
  170. var onabort : haxe.Constraints.Function;
  171. var onblur : haxe.Constraints.Function;
  172. var onfocus : haxe.Constraints.Function;
  173. var oncanplay : haxe.Constraints.Function;
  174. var oncanplaythrough : haxe.Constraints.Function;
  175. var onchange : haxe.Constraints.Function;
  176. var onclick : haxe.Constraints.Function;
  177. var oncontextmenu : haxe.Constraints.Function;
  178. var ondblclick : haxe.Constraints.Function;
  179. var ondrag : haxe.Constraints.Function;
  180. var ondragend : haxe.Constraints.Function;
  181. var ondragenter : haxe.Constraints.Function;
  182. var ondragleave : haxe.Constraints.Function;
  183. var ondragover : haxe.Constraints.Function;
  184. var ondragstart : haxe.Constraints.Function;
  185. var ondrop : haxe.Constraints.Function;
  186. var ondurationchange : haxe.Constraints.Function;
  187. var onemptied : haxe.Constraints.Function;
  188. var onended : haxe.Constraints.Function;
  189. var oninput : haxe.Constraints.Function;
  190. var oninvalid : haxe.Constraints.Function;
  191. var onkeydown : haxe.Constraints.Function;
  192. var onkeypress : haxe.Constraints.Function;
  193. var onkeyup : haxe.Constraints.Function;
  194. var onload : haxe.Constraints.Function;
  195. var onloadeddata : haxe.Constraints.Function;
  196. var onloadedmetadata : haxe.Constraints.Function;
  197. var onloadstart : haxe.Constraints.Function;
  198. var onmousedown : haxe.Constraints.Function;
  199. var onmouseenter : haxe.Constraints.Function;
  200. var onmouseleave : haxe.Constraints.Function;
  201. var onmousemove : haxe.Constraints.Function;
  202. var onmouseout : haxe.Constraints.Function;
  203. var onmouseover : haxe.Constraints.Function;
  204. var onmouseup : haxe.Constraints.Function;
  205. var onpause : haxe.Constraints.Function;
  206. var onplay : haxe.Constraints.Function;
  207. var onplaying : haxe.Constraints.Function;
  208. var onprogress : haxe.Constraints.Function;
  209. var onratechange : haxe.Constraints.Function;
  210. var onreset : haxe.Constraints.Function;
  211. var onresize : haxe.Constraints.Function;
  212. var onscroll : haxe.Constraints.Function;
  213. var onseeked : haxe.Constraints.Function;
  214. var onseeking : haxe.Constraints.Function;
  215. var onselect : haxe.Constraints.Function;
  216. var onshow : haxe.Constraints.Function;
  217. var onstalled : haxe.Constraints.Function;
  218. var onsubmit : haxe.Constraints.Function;
  219. var onsuspend : haxe.Constraints.Function;
  220. var ontimeupdate : haxe.Constraints.Function;
  221. var onvolumechange : haxe.Constraints.Function;
  222. var onwaiting : haxe.Constraints.Function;
  223. var onpointercancel : haxe.Constraints.Function;
  224. var onpointerdown : haxe.Constraints.Function;
  225. var onpointerup : haxe.Constraints.Function;
  226. var onpointermove : haxe.Constraints.Function;
  227. var onpointerout : haxe.Constraints.Function;
  228. var onpointerover : haxe.Constraints.Function;
  229. var onpointerenter : haxe.Constraints.Function;
  230. var onpointerleave : haxe.Constraints.Function;
  231. var ongotpointercapture : haxe.Constraints.Function;
  232. var onlostpointercapture : haxe.Constraints.Function;
  233. /**
  234. Is an `EventHandler` representing the code to be called when the `fullscreenchange` event is raised.
  235. **/
  236. var onfullscreenchange : haxe.Constraints.Function;
  237. /**
  238. Is an `EventHandler` representing the code to be called when the `fullscreenerror` event is raised.
  239. **/
  240. var onfullscreenerror : haxe.Constraints.Function;
  241. /**
  242. Represents the event handling code for the `pointerlockchange` event.
  243. **/
  244. var onpointerlockchange : haxe.Constraints.Function;
  245. /**
  246. Represetnts the event handling code for the `pointerlockerror` event.
  247. **/
  248. var onpointerlockerror : haxe.Constraints.Function;
  249. var onerror : haxe.Constraints.Function;
  250. var children(default,null) : HTMLCollection;
  251. var firstElementChild(default,null) : Element;
  252. var lastElementChild(default,null) : Element;
  253. var childElementCount(default,null) : Int;
  254. var ontouchstart : haxe.Constraints.Function;
  255. var ontouchend : haxe.Constraints.Function;
  256. var ontouchmove : haxe.Constraints.Function;
  257. var ontouchcancel : haxe.Constraints.Function;
  258. /** @throws DOMError */
  259. function new() : Void;
  260. /**
  261. Returns a list of elements with the given tag name.
  262. **/
  263. function getElementsByTagName( localName : String ) : HTMLCollection;
  264. /** @throws DOMError */
  265. /**
  266. Returns a list of elements with the given tag name and namespace.
  267. **/
  268. function getElementsByTagNameNS( namespace_ : String, localName : String ) : HTMLCollection;
  269. /**
  270. Returns a list of elements with the given class name.
  271. **/
  272. function getElementsByClassName( classNames : String ) : HTMLCollection;
  273. function getElementById( elementId : String ) : Element;
  274. /** @throws DOMError */
  275. @:overload( function( localName : String ) : Element {} )
  276. /**
  277. Creates a new element with the given tag name.
  278. **/
  279. function createElement( localName : String, typeExtension : String ) : Element;
  280. /** @throws DOMError */
  281. @:overload( function( namespace_ : String, qualifiedName : String ) : Element {} )
  282. /**
  283. Creates a new element with the given tag name and namespace URI.
  284. **/
  285. function createElementNS( namespace_ : String, qualifiedName : String, typeExtension : String ) : Element;
  286. /**
  287. Creates a new document fragment.
  288. **/
  289. function createDocumentFragment() : DocumentFragment;
  290. /**
  291. Creates a text node.
  292. **/
  293. function createTextNode( data : String ) : Text;
  294. /**
  295. Creates a new comment node and returns it.
  296. **/
  297. function createComment( data : String ) : Comment;
  298. /** @throws DOMError */
  299. /**
  300. Creates a new `ProcessingInstruction` object.
  301. **/
  302. function createProcessingInstruction( target : String, data : String ) : ProcessingInstruction;
  303. /** @throws DOMError */
  304. /**
  305. Returns a clone of a node from an external document.
  306. **/
  307. function importNode( node : Node, ?deep : Bool = false ) : Node;
  308. /** @throws DOMError */
  309. /**
  310. Adopt node from an external document.
  311. **/
  312. function adoptNode( node : Node ) : Node;
  313. /** @throws DOMError */
  314. /**
  315. Creates an event object.
  316. **/
  317. function createEvent( interface_ : String ) : Event;
  318. /** @throws DOMError */
  319. /**
  320. Creates a `Range` object.
  321. **/
  322. function createRange() : Range;
  323. /** @throws DOMError */
  324. /**
  325. Creates a `NodeIterator` object.
  326. **/
  327. function createNodeIterator( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : NodeIterator;
  328. /** @throws DOMError */
  329. /**
  330. Creates a `TreeWalker` object.
  331. **/
  332. function createTreeWalker( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter ) : TreeWalker;
  333. /** @throws DOMError */
  334. /**
  335. Creates a new CDATA node and returns it.
  336. **/
  337. function createCDATASection( data : String ) : CDATASection;
  338. /** @throws DOMError */
  339. /**
  340. Creates a new `Attr` object and returns it.
  341. **/
  342. function createAttribute( name : String ) : Attr;
  343. /** @throws DOMError */
  344. /**
  345. Creates a new attribute node in a given namespace and returns it.
  346. **/
  347. function createAttributeNS( namespace_ : String, name : String ) : Attr;
  348. /** @throws DOMError */
  349. function hasFocus() : Bool;
  350. /**
  351. Releases the current mouse capture if it's on an element in this document.
  352. **/
  353. function releaseCapture() : Void;
  354. function exitFullscreen() : Void;
  355. /**
  356. Release the pointer lock.
  357. **/
  358. function exitPointerLock() : Void;
  359. /** @throws DOMError */
  360. /**
  361. Registers a web component.
  362. **/
  363. function registerElement( name : String, ?options : ElementRegistrationOptions ) : Dynamic;
  364. /**
  365. Enables the style sheets for the specified style sheet set.
  366. **/
  367. function enableStyleSheetsForSet( name : String ) : Void;
  368. /**
  369. Returns the topmost element at the specified coordinates. 
  370. **/
  371. function elementFromPoint( x : Float, y : Float ) : Element;
  372. /**
  373. Returns an array of all elements at the specified coordinates.
  374. **/
  375. function elementsFromPoint( x : Float, y : Float ) : Array<Element>;
  376. /**
  377. Gets the `CaretPosition` at or near the specified coordinates.
  378. **/
  379. function caretPositionFromPoint( x : Float, y : Float ) : CaretPosition;
  380. /** @throws DOMError */
  381. function querySelector( selectors : String ) : Element;
  382. /** @throws DOMError */
  383. function querySelectorAll( selectors : String ) : NodeList;
  384. /**
  385. Returns an array of all `Animation` objects currently in effect whose target elements are descendants of the `document`.
  386. **/
  387. function getAnimations() : Array<Animation>;
  388. /**
  389. Creates a `Touch` object.
  390. **/
  391. 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;
  392. @:overload( function( touch : Touch, touches : haxe.extern.Rest<Touch> ) : TouchList {} )
  393. @:overload( function() : TouchList {} )
  394. /**
  395. Creates a `TouchList` object.
  396. **/
  397. function createTouchList( touches : Array<Touch> ) : TouchList;
  398. /** @throws DOMError */
  399. function convertQuadFromNode( quad : DOMQuad, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
  400. /** @throws DOMError */
  401. function convertRectFromNode( rect : DOMRectReadOnly, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMQuad;
  402. /** @throws DOMError */
  403. function convertPointFromNode( point : DOMPointInit, from : haxe.extern.EitherType<Text,haxe.extern.EitherType<Element,HTMLDocument>>, ?options : ConvertCoordinateOptions ) : DOMPoint;
  404. /** @throws DOMError */
  405. function createExpression( expression : String, resolver : XPathNSResolver ) : XPathExpression;
  406. function createNSResolver( nodeResolver : Node ) : Node;
  407. /** @throws DOMError */
  408. function evaluate( expression : String, contextNode : Node, resolver : XPathNSResolver, type : Int, result : Dynamic ) : XPathResult;
  409. }