Document.hx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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.`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. /**
  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 `HTMLElement` 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 the 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 the `body` or `frameset` node of the current document.
  98. **/
  99. var body : Element;
  100. /**
  101. Returns the `head` element of the current document.
  102. **/
  103. var head(default,null) : HeadElement;
  104. /**
  105. Returns a list of the images in the current document.
  106. **/
  107. var images(default,null) : HTMLCollection;
  108. /**
  109. Returns a list of the embedded `embed` elements within the current document.
  110. **/
  111. var embeds(default,null) : HTMLCollection;
  112. /**
  113. Returns a list of the available plugins.
  114. **/
  115. var plugins(default,null) : HTMLCollection;
  116. /**
  117. Returns a list of all the hyperlinks in the document.
  118. **/
  119. var links(default,null) : HTMLCollection;
  120. /**
  121. Returns a list of the `form` elements within the current document.
  122. **/
  123. var forms(default,null) : HTMLCollection;
  124. /**
  125. Returns all the `script` elements on the document.
  126. **/
  127. var scripts(default,null) : HTMLCollection;
  128. /**
  129. Returns a reference to the window object.
  130. **/
  131. var defaultView(default,null) : Window;
  132. /**
  133. Represents the event handling code for the `readystatechange` event.
  134. **/
  135. var onreadystatechange : haxe.Constraints.Function;
  136. /**
  137. Represents the event handling code for the `beforescriptexecute` event.
  138. **/
  139. var onbeforescriptexecute : haxe.Constraints.Function;
  140. /**
  141. Represents the event handling code for the `afterscriptexecute` event.
  142. **/
  143. var onafterscriptexecute : haxe.Constraints.Function;
  144. var currentScript(default,null) : Element;
  145. /**
  146. Returns a list of all of the anchors in the document.
  147. **/
  148. var anchors(default,null) : HTMLCollection;
  149. /**
  150. Returns an ordered list of the applets within a document.
  151. **/
  152. var applets(default,null) : HTMLCollection;
  153. /**
  154. Represents the event handling code for the `pointerlockchange` event.
  155. **/
  156. var onpointerlockchange : haxe.Constraints.Function;
  157. /**
  158. Represents the event handling code for the `pointerlockerror` event.
  159. **/
  160. var onpointerlockerror : haxe.Constraints.Function;
  161. /**
  162. **/
  163. var hidden(default,null) : Bool;
  164. /**
  165. Returns a `string` denoting the visibility state of the document. Possible values are `visible`,  `hidden`,  `prerender`, and `unloaded`.
  166. **/
  167. var visibilityState(default,null) : VisibilityState;
  168. /**
  169. Is an `EventHandler` representing the code to be called when the `visibilitychange` event is raised.
  170. **/
  171. var onvisibilitychange : haxe.Constraints.Function;
  172. /**
  173. Returns which style sheet set is currently in use.
  174. **/
  175. var selectedStyleSheetSet : String;
  176. /**
  177. 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`.
  178. **/
  179. var lastStyleSheetSet(default,null) : String;
  180. /**
  181. Returns the preferred style sheet set as specified by the page author.
  182. **/
  183. var preferredStyleSheetSet(default,null) : String;
  184. /**
  185. Returns a list of the style sheet sets available on the document.
  186. **/
  187. var styleSheetSets(default,null) : DOMStringList;
  188. /**
  189. Returns a reference to the `Element` that scrolls the document.
  190. **/
  191. var scrollingElement(default,null) : Element;
  192. /**
  193. **/
  194. var timeline(default,null) : DocumentTimeline;
  195. var rootElement(default,null) : js.html.svg.SVGElement;
  196. /**
  197. Represents the event handling code for the `copy` event.
  198. **/
  199. var oncopy : haxe.Constraints.Function;
  200. /**
  201. Represents the event handling code for the `cut` event.
  202. **/
  203. var oncut : haxe.Constraints.Function;
  204. /**
  205. Represents the event handling code for the `paste` event.
  206. **/
  207. var onpaste : haxe.Constraints.Function;
  208. var activeElement(default,null) : Element;
  209. var styleSheets(default,null) : StyleSheetList;
  210. var pointerLockElement(default,null) : Element;
  211. var fonts(default,null) : FontFaceSet;
  212. var onabort : haxe.Constraints.Function;
  213. var onblur : haxe.Constraints.Function;
  214. var onfocus : haxe.Constraints.Function;
  215. var onauxclick : haxe.Constraints.Function;
  216. var oncanplay : haxe.Constraints.Function;
  217. var oncanplaythrough : haxe.Constraints.Function;
  218. var onchange : haxe.Constraints.Function;
  219. var onclick : haxe.Constraints.Function;
  220. var onclose : haxe.Constraints.Function;
  221. var oncontextmenu : haxe.Constraints.Function;
  222. var ondblclick : haxe.Constraints.Function;
  223. var ondrag : haxe.Constraints.Function;
  224. var ondragend : haxe.Constraints.Function;
  225. var ondragenter : haxe.Constraints.Function;
  226. var ondragexit : haxe.Constraints.Function;
  227. var ondragleave : haxe.Constraints.Function;
  228. var ondragover : haxe.Constraints.Function;
  229. var ondragstart : haxe.Constraints.Function;
  230. var ondrop : haxe.Constraints.Function;
  231. var ondurationchange : haxe.Constraints.Function;
  232. var onemptied : haxe.Constraints.Function;
  233. var onended : haxe.Constraints.Function;
  234. var oninput : haxe.Constraints.Function;
  235. var oninvalid : haxe.Constraints.Function;
  236. var onkeydown : haxe.Constraints.Function;
  237. var onkeypress : haxe.Constraints.Function;
  238. var onkeyup : haxe.Constraints.Function;
  239. var onload : haxe.Constraints.Function;
  240. var onloadeddata : haxe.Constraints.Function;
  241. var onloadedmetadata : haxe.Constraints.Function;
  242. var onloadend : haxe.Constraints.Function;
  243. var onloadstart : haxe.Constraints.Function;
  244. var onmousedown : haxe.Constraints.Function;
  245. var onmouseenter : haxe.Constraints.Function;
  246. var onmouseleave : haxe.Constraints.Function;
  247. var onmousemove : haxe.Constraints.Function;
  248. var onmouseout : haxe.Constraints.Function;
  249. var onmouseover : haxe.Constraints.Function;
  250. var onmouseup : haxe.Constraints.Function;
  251. /**
  252. Represents the event handling code for the `wheel` event.
  253. **/
  254. var onwheel : haxe.Constraints.Function;
  255. var onpause : haxe.Constraints.Function;
  256. var onplay : haxe.Constraints.Function;
  257. var onplaying : haxe.Constraints.Function;
  258. var onprogress : haxe.Constraints.Function;
  259. var onratechange : haxe.Constraints.Function;
  260. var onreset : haxe.Constraints.Function;
  261. var onresize : haxe.Constraints.Function;
  262. var onscroll : haxe.Constraints.Function;
  263. var onseeked : haxe.Constraints.Function;
  264. var onseeking : haxe.Constraints.Function;
  265. var onselect : haxe.Constraints.Function;
  266. var onshow : haxe.Constraints.Function;
  267. var onstalled : haxe.Constraints.Function;
  268. var onsubmit : haxe.Constraints.Function;
  269. var onsuspend : haxe.Constraints.Function;
  270. var ontimeupdate : haxe.Constraints.Function;
  271. var onvolumechange : haxe.Constraints.Function;
  272. var onwaiting : haxe.Constraints.Function;
  273. var ontoggle : haxe.Constraints.Function;
  274. var onpointercancel : haxe.Constraints.Function;
  275. var onpointerdown : haxe.Constraints.Function;
  276. var onpointerup : haxe.Constraints.Function;
  277. var onpointermove : haxe.Constraints.Function;
  278. var onpointerout : haxe.Constraints.Function;
  279. var onpointerover : haxe.Constraints.Function;
  280. var onpointerenter : haxe.Constraints.Function;
  281. var onpointerleave : haxe.Constraints.Function;
  282. var ongotpointercapture : haxe.Constraints.Function;
  283. var onlostpointercapture : haxe.Constraints.Function;
  284. var onanimationcancel : haxe.Constraints.Function;
  285. var onanimationend : haxe.Constraints.Function;
  286. var onanimationiteration : haxe.Constraints.Function;
  287. var onanimationstart : haxe.Constraints.Function;
  288. var ontransitioncancel : haxe.Constraints.Function;
  289. var ontransitionend : haxe.Constraints.Function;
  290. var ontransitionrun : haxe.Constraints.Function;
  291. var ontransitionstart : haxe.Constraints.Function;
  292. var onwebkitanimationend : haxe.Constraints.Function;
  293. var onwebkitanimationiteration : haxe.Constraints.Function;
  294. var onwebkitanimationstart : haxe.Constraints.Function;
  295. var onwebkittransitionend : haxe.Constraints.Function;
  296. var onerror : haxe.Constraints.Function;
  297. var children(default,null) : HTMLCollection;
  298. var firstElementChild(default,null) : Element;
  299. var lastElementChild(default,null) : Element;
  300. var childElementCount(default,null) : Int;
  301. var ontouchstart : haxe.Constraints.Function;
  302. var ontouchend : haxe.Constraints.Function;
  303. var ontouchmove : haxe.Constraints.Function;
  304. var ontouchcancel : haxe.Constraints.Function;
  305. /** @throws DOMError */
  306. function new() : Void;
  307. /**
  308. Returns a list of elements with the given tag name.
  309. **/
  310. @:pure
  311. function getElementsByTagName( localName : String ) : HTMLCollection;
  312. /**
  313. Returns a list of elements with the given tag name and namespace.
  314. @throws DOMError
  315. **/
  316. @:pure
  317. function getElementsByTagNameNS( namespace : String, localName : String ) : HTMLCollection;
  318. /**
  319. Returns a list of elements with the given class name.
  320. **/
  321. @:pure
  322. function getElementsByClassName( classNames : String ) : HTMLCollection;
  323. @:pure
  324. function getElementById( elementId : String ) : Element;
  325. /**
  326. Creates a new element with the given tag name.
  327. @throws DOMError
  328. **/
  329. @:overload( function( localName : String, ?options : String) : Element {} )
  330. function createElement( localName : String, ?options : ElementCreationOptions ) : Element;
  331. /**
  332. Creates a new element with the given tag name and namespace URI.
  333. @throws DOMError
  334. **/
  335. @:overload( function( namespace : String, qualifiedName : String, ?options : String) : Element {} )
  336. function createElementNS( namespace : String, qualifiedName : String, ?options : ElementCreationOptions ) : Element;
  337. /**
  338. Creates a new document fragment.
  339. **/
  340. function createDocumentFragment() : DocumentFragment;
  341. /**
  342. Creates a text node.
  343. **/
  344. function createTextNode( data : String ) : Text;
  345. /**
  346. Creates a new comment node and returns it.
  347. **/
  348. function createComment( data : String ) : Comment;
  349. /**
  350. Creates a new `ProcessingInstruction` object.
  351. @throws DOMError
  352. **/
  353. function createProcessingInstruction( target : String, data : String ) : ProcessingInstruction;
  354. /**
  355. Returns a clone of a node from an external document.
  356. @throws DOMError
  357. **/
  358. function importNode( node : Node, ?deep : Bool = false ) : Node;
  359. /**
  360. Adopt node from an external document.
  361. @throws DOMError
  362. **/
  363. function adoptNode( node : Node ) : Node;
  364. /**
  365. Creates an event object.
  366. @throws DOMError
  367. **/
  368. function createEvent( interface_ : String ) : Event;
  369. /**
  370. Creates a `Range` object.
  371. @throws DOMError
  372. **/
  373. function createRange() : Range;
  374. /**
  375. Creates a `NodeIterator` object.
  376. @throws DOMError
  377. **/
  378. @:overload( function( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : haxe.Constraints.Function) : NodeIterator {} )
  379. @:overload( function( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter) : NodeIterator {} )
  380. function createNodeIterator( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : Node -> Int ) : NodeIterator;
  381. /**
  382. Creates a `TreeWalker` object.
  383. @throws DOMError
  384. **/
  385. @:overload( function( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : haxe.Constraints.Function) : TreeWalker {} )
  386. @:overload( function( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : NodeFilter) : TreeWalker {} )
  387. function createTreeWalker( root : Node, ?whatToShow : Int = cast 4294967295, ?filter : Node -> Int ) : TreeWalker;
  388. /**
  389. Creates a new CDATA node and returns it.
  390. @throws DOMError
  391. **/
  392. function createCDATASection( data : String ) : CDATASection;
  393. /**
  394. Creates a new `Attr` object and returns it.
  395. @throws DOMError
  396. **/
  397. function createAttribute( name : String ) : Attr;
  398. /**
  399. Creates a new attribute node in a given namespace and returns it.
  400. @throws DOMError
  401. **/
  402. function createAttributeNS( namespace : String, name : String ) : Attr;
  403. @:pure
  404. function getElementsByName( elementName : String ) : NodeList;
  405. /**
  406. Returns `true` if the focus is currently located anywhere inside the specified document.
  407. @throws DOMError
  408. **/
  409. function hasFocus() : Bool;
  410. /**
  411. Releases the current mouse capture if it's on an element in this document.
  412. **/
  413. function releaseCapture() : Void;
  414. /**
  415. Release the pointer lock.
  416. **/
  417. function exitPointerLock() : Void;
  418. /**
  419. Enables the style sheets for the specified style sheet set.
  420. **/
  421. function enableStyleSheetsForSet( name : String ) : Void;
  422. function caretPositionFromPoint( x : Float, y : Float ) : CaretPosition;
  423. /** @throws DOMError */
  424. @:pure
  425. function querySelector( selectors : String ) : Element;
  426. /** @throws DOMError */
  427. @:pure
  428. function querySelectorAll( selectors : String ) : NodeList;
  429. /**
  430. Returns an array of all `Animation` objects currently in effect, whose target elements are descendants of the `document`.
  431. **/
  432. function getAnimations() : Array<Animation>;
  433. /**
  434. Creates a `Touch` object.
  435. **/
  436. 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;
  437. /**
  438. Creates a `TouchList` object.
  439. **/
  440. @:overload( function( touch : Touch, touches : haxe.extern.Rest<Touch> ) : TouchList {} )
  441. @:overload( function() : TouchList {} )
  442. function createTouchList( touches : Array<Touch> ) : TouchList;
  443. /** @throws DOMError */
  444. function getSelection() : Selection;
  445. function elementFromPoint( x : Float, y : Float ) : Element;
  446. function elementsFromPoint( x : Float, y : Float ) : Array<Element>;
  447. /** @throws DOMError */
  448. @:overload( function( quad : DOMQuad, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  449. @:overload( function( quad : DOMQuad, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  450. function convertQuadFromNode( quad : DOMQuad, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  451. /** @throws DOMError */
  452. @:overload( function( rect : DOMRectReadOnly, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  453. @:overload( function( rect : DOMRectReadOnly, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  454. function convertRectFromNode( rect : DOMRectReadOnly, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  455. /** @throws DOMError */
  456. @:overload( function( point : DOMPointInit, from : Element, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  457. @:overload( function( point : DOMPointInit, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  458. function convertPointFromNode( point : DOMPointInit, from : Text, ?options : ConvertCoordinateOptions ) : DOMPoint;
  459. /** @throws DOMError */
  460. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  461. function prepend( nodes : haxe.extern.Rest<Node> ) : Void;
  462. /** @throws DOMError */
  463. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  464. function append( nodes : haxe.extern.Rest<Node> ) : Void;
  465. /** @throws DOMError */
  466. @:overload( function( expression : String, ?resolver : haxe.Constraints.Function) : XPathExpression {} )
  467. @:overload( function( expression : String, ?resolver : XPathNSResolver) : XPathExpression {} )
  468. function createExpression( expression : String, ?resolver : String -> String ) : XPathExpression;
  469. @:pure
  470. function createNSResolver( nodeResolver : Node ) : Node;
  471. /** @throws DOMError */
  472. @:overload( function( expression : String, contextNode : Node, ?resolver : haxe.Constraints.Function, ?type : Int = 0, ?result : Dynamic) : XPathResult {} )
  473. @:overload( function( expression : String, contextNode : Node, ?resolver : XPathNSResolver, ?type : Int = 0, ?result : Dynamic) : XPathResult {} )
  474. function evaluate( expression : String, contextNode : Node, ?resolver : String -> String, ?type : Int = 0, ?result : Dynamic ) : XPathResult;
  475. }