DOMElement.hx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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\Element.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. `Element` is the most general base class from which all objects in a `Document` inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from `Element`.
  26. Documentation [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Element$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/Element>
  28. **/
  29. @:native("Element")
  30. extern class DOMElement extends Node {
  31. /**
  32. The namespace URI of the element, or `null` if it is no namespace.
  33. Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the `http://www.w3.org/1999/xhtml` namespace in both HTML and XML trees. `1.9.2`
  34. **/
  35. var namespaceURI(default,null) : String;
  36. /**
  37. A `DOMString` representing the namespace prefix of the element, or `null` if no prefix is specified.
  38. **/
  39. var prefix(default,null) : String;
  40. /**
  41. A `DOMString` representing the local part of the qualified name of the element.
  42. **/
  43. var localName(default,null) : String;
  44. /**
  45. Returns a `String` with the name of the tag for the given element.
  46. **/
  47. var tagName(default,null) : String;
  48. /**
  49. Is a `DOMString` representing the id of the element.
  50. **/
  51. var id : String;
  52. /**
  53. Is a `DOMString` representing the class of the element.
  54. **/
  55. var className : String;
  56. /**
  57. Returns a `DOMTokenList` containing the list of class attributes.
  58. **/
  59. var classList(default,null) : DOMTokenList;
  60. /**
  61. Returns a `NamedNodeMap` object containing the assigned attributes of the corresponding HTML element.
  62. **/
  63. var attributes(default,null) : NamedNodeMap;
  64. var title : String;
  65. var lang : String;
  66. var dir : String;
  67. var dataset(default,null) : DOMStringMap;
  68. var innerText : String;
  69. var itemScope : Bool;
  70. var itemType(default,null) : DOMTokenList;
  71. var itemId : String;
  72. var itemRef(default,null) : DOMTokenList;
  73. var itemProp(default,null) : DOMTokenList;
  74. var properties(default,null) : HTMLPropertiesCollection;
  75. var itemValue : Dynamic;
  76. var hidden : Bool;
  77. var tabIndex : Int;
  78. var accessKey : String;
  79. var accessKeyLabel(default,null) : String;
  80. var draggable : Bool;
  81. var contentEditable : String;
  82. var isContentEditable(default,null) : Bool;
  83. var contextMenu(default,null) : MenuElement;
  84. var spellcheck : Bool;
  85. var style(default,null) : CSSStyleDeclaration;
  86. var oncopy : haxe.Constraints.Function;
  87. var oncut : haxe.Constraints.Function;
  88. var onpaste : haxe.Constraints.Function;
  89. var offsetParent(default,null) : Element;
  90. var offsetTop(default,null) : Int;
  91. var offsetLeft(default,null) : Int;
  92. var offsetWidth(default,null) : Int;
  93. var offsetHeight(default,null) : Int;
  94. /**
  95. A `Number` representing number of pixels the top of the document is scrolled vertically.
  96. **/
  97. var scrollTop : Int;
  98. /**
  99. Is a `Number` representing the left scroll offset of the element.
  100. **/
  101. var scrollLeft : Int;
  102. /**
  103. Returns a `Number` representing the scroll view width of the element.
  104. **/
  105. var scrollWidth(default,null) : Int;
  106. /**
  107. Returns a `Number` representing the scroll view height of an element.
  108. **/
  109. var scrollHeight(default,null) : Int;
  110. /**
  111. Returns a `Number` representing the width of the top border of the element.
  112. **/
  113. var clientTop(default,null) : Int;
  114. /**
  115. Returns a `Number` representing the width of the left border of the element.
  116. **/
  117. var clientLeft(default,null) : Int;
  118. /**
  119. Returns a `Number` representing the inner width of the element.
  120. **/
  121. var clientWidth(default,null) : Int;
  122. /**
  123. Returns a `Number` representing the inner height of the element.
  124. **/
  125. var clientHeight(default,null) : Int;
  126. /**
  127. Returns a `Number` representing the maximum top scroll offset possible for the element.
  128. **/
  129. var scrollTopMax(default,null) : Int;
  130. /**
  131. Returns a `Number` representing the maximum left scroll offset possible for the element.
  132. **/
  133. var scrollLeftMax(default,null) : Int;
  134. /**
  135. Is a `DOMString` representing the markup of the element's content.
  136. **/
  137. var innerHTML : String;
  138. /**
  139. Is a `DOMString` representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string.
  140. **/
  141. var outerHTML : String;
  142. /**
  143. Returns the open shadow root that is hosted by the element, or null if no open shadow root is present.
  144. **/
  145. var shadowRoot(default,null) : ShadowRoot;
  146. var assignedSlot(default,null) : SlotElement;
  147. /**
  148. Returns the name of the shadow DOM slot the element is inserted in.
  149. **/
  150. var slot : String;
  151. var onabort : haxe.Constraints.Function;
  152. var onblur : haxe.Constraints.Function;
  153. var onfocus : haxe.Constraints.Function;
  154. var onauxclick : haxe.Constraints.Function;
  155. var oncanplay : haxe.Constraints.Function;
  156. var oncanplaythrough : haxe.Constraints.Function;
  157. var onchange : haxe.Constraints.Function;
  158. var onclick : haxe.Constraints.Function;
  159. var onclose : haxe.Constraints.Function;
  160. var oncontextmenu : haxe.Constraints.Function;
  161. var ondblclick : haxe.Constraints.Function;
  162. var ondrag : haxe.Constraints.Function;
  163. var ondragend : haxe.Constraints.Function;
  164. var ondragenter : haxe.Constraints.Function;
  165. var ondragexit : haxe.Constraints.Function;
  166. var ondragleave : haxe.Constraints.Function;
  167. var ondragover : haxe.Constraints.Function;
  168. var ondragstart : haxe.Constraints.Function;
  169. var ondrop : haxe.Constraints.Function;
  170. var ondurationchange : haxe.Constraints.Function;
  171. var onemptied : haxe.Constraints.Function;
  172. var onended : haxe.Constraints.Function;
  173. var oninput : haxe.Constraints.Function;
  174. var oninvalid : haxe.Constraints.Function;
  175. var onkeydown : haxe.Constraints.Function;
  176. var onkeypress : haxe.Constraints.Function;
  177. var onkeyup : haxe.Constraints.Function;
  178. var onload : haxe.Constraints.Function;
  179. var onloadeddata : haxe.Constraints.Function;
  180. var onloadedmetadata : haxe.Constraints.Function;
  181. var onloadend : haxe.Constraints.Function;
  182. var onloadstart : haxe.Constraints.Function;
  183. var onmousedown : haxe.Constraints.Function;
  184. var onmouseenter : haxe.Constraints.Function;
  185. var onmouseleave : haxe.Constraints.Function;
  186. var onmousemove : haxe.Constraints.Function;
  187. var onmouseout : haxe.Constraints.Function;
  188. var onmouseover : haxe.Constraints.Function;
  189. var onmouseup : haxe.Constraints.Function;
  190. /**
  191. Returns the event handling code for the `wheel` event. This is now implemented on `GlobalEventHandlers.onwheel`.
  192. **/
  193. var onwheel : haxe.Constraints.Function;
  194. var onpause : haxe.Constraints.Function;
  195. var onplay : haxe.Constraints.Function;
  196. var onplaying : haxe.Constraints.Function;
  197. var onprogress : haxe.Constraints.Function;
  198. var onratechange : haxe.Constraints.Function;
  199. var onreset : haxe.Constraints.Function;
  200. var onresize : haxe.Constraints.Function;
  201. var onscroll : haxe.Constraints.Function;
  202. var onseeked : haxe.Constraints.Function;
  203. var onseeking : haxe.Constraints.Function;
  204. var onselect : haxe.Constraints.Function;
  205. var onshow : haxe.Constraints.Function;
  206. var onstalled : haxe.Constraints.Function;
  207. var onsubmit : haxe.Constraints.Function;
  208. var onsuspend : haxe.Constraints.Function;
  209. var ontimeupdate : haxe.Constraints.Function;
  210. var onvolumechange : haxe.Constraints.Function;
  211. var onwaiting : haxe.Constraints.Function;
  212. var onselectstart : haxe.Constraints.Function;
  213. var ontoggle : haxe.Constraints.Function;
  214. var onpointercancel : haxe.Constraints.Function;
  215. var onpointerdown : haxe.Constraints.Function;
  216. var onpointerup : haxe.Constraints.Function;
  217. var onpointermove : haxe.Constraints.Function;
  218. var onpointerout : haxe.Constraints.Function;
  219. var onpointerover : haxe.Constraints.Function;
  220. var onpointerenter : haxe.Constraints.Function;
  221. var onpointerleave : haxe.Constraints.Function;
  222. /**
  223. Returns the event handler for the `gotpointercapture` event type.
  224. **/
  225. var ongotpointercapture : haxe.Constraints.Function;
  226. /**
  227. Returns the event handler for the `lostpointercapture` event type.
  228. **/
  229. var onlostpointercapture : haxe.Constraints.Function;
  230. var onanimationcancel : haxe.Constraints.Function;
  231. var onanimationend : haxe.Constraints.Function;
  232. var onanimationiteration : haxe.Constraints.Function;
  233. var onanimationstart : haxe.Constraints.Function;
  234. var ontransitioncancel : haxe.Constraints.Function;
  235. var ontransitionend : haxe.Constraints.Function;
  236. var ontransitionrun : haxe.Constraints.Function;
  237. var ontransitionstart : haxe.Constraints.Function;
  238. var onwebkitanimationend : haxe.Constraints.Function;
  239. var onwebkitanimationiteration : haxe.Constraints.Function;
  240. var onwebkitanimationstart : haxe.Constraints.Function;
  241. var onwebkittransitionend : haxe.Constraints.Function;
  242. var previousElementSibling(default,null) : Element;
  243. var nextElementSibling(default,null) : Element;
  244. var onerror : haxe.Constraints.Function;
  245. var children(default,null) : HTMLCollection;
  246. var firstElementChild(default,null) : Element;
  247. var lastElementChild(default,null) : Element;
  248. var childElementCount(default,null) : Int;
  249. var ontouchstart : haxe.Constraints.Function;
  250. var ontouchend : haxe.Constraints.Function;
  251. var ontouchmove : haxe.Constraints.Function;
  252. var ontouchcancel : haxe.Constraints.Function;
  253. /**
  254. Returns an array of attribute names from the current element.
  255. **/
  256. @:pure
  257. function getAttributeNames() : Array<String>;
  258. /**
  259. Retrieves the value of the named attribute from the current node and returns it as an `Object`.
  260. **/
  261. @:pure
  262. function getAttribute( name : String ) : String;
  263. /**
  264. Retrieves the value of the attribute with the specified name and namespace, from the current node and returns it as an `Object`.
  265. **/
  266. @:pure
  267. function getAttributeNS( namespace : String, localName : String ) : String;
  268. /**
  269. Toggles a boolean attribute, removing it if it is present and adding it if it is not present, on the specified element.
  270. @throws DOMError
  271. **/
  272. function toggleAttribute( name : String, ?force : Bool ) : Bool;
  273. /**
  274. Sets the value of a named attribute of the current node.
  275. @throws DOMError
  276. **/
  277. function setAttribute( name : String, value : String ) : Void;
  278. /**
  279. Sets the value of the attribute with the specified name and namespace, from the current node.
  280. @throws DOMError
  281. **/
  282. function setAttributeNS( namespace : String, name : String, value : String ) : Void;
  283. /**
  284. Removes the named attribute from the current node.
  285. @throws DOMError
  286. **/
  287. function removeAttribute( name : String ) : Void;
  288. /**
  289. Removes the attribute with the specified name and namespace, from the current node.
  290. @throws DOMError
  291. **/
  292. function removeAttributeNS( namespace : String, localName : String ) : Void;
  293. /**
  294. Returns a `Boolean` indicating if the element has the specified attribute or not.
  295. **/
  296. @:pure
  297. function hasAttribute( name : String ) : Bool;
  298. /**
  299. Returns a `Boolean` indicating if the element has the specified attribute, in the specified namespace, or not.
  300. **/
  301. @:pure
  302. function hasAttributeNS( namespace : String, localName : String ) : Bool;
  303. /**
  304. Returns a `Boolean` indicating if the element has one or more HTML attributes present.
  305. **/
  306. @:pure
  307. function hasAttributes() : Bool;
  308. /**
  309. Returns the `Element` which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter.
  310. @throws DOMError
  311. **/
  312. @:pure
  313. function closest( selector : String ) : Element;
  314. /**
  315. Returns a `Boolean` indicating whether or not the element would be selected by the specified selector string.
  316. @throws DOMError
  317. **/
  318. @:pure
  319. function matches( selector : String ) : Bool;
  320. /** @throws DOMError */
  321. @:pure
  322. function webkitMatchesSelector( selector : String ) : Bool;
  323. /**
  324. Returns a live `HTMLCollection` containing all descendant elements, of a particular tag name, from the current element.
  325. **/
  326. @:pure
  327. function getElementsByTagName( localName : String ) : HTMLCollection;
  328. /**
  329. Returns a live `HTMLCollection` containing all descendant elements, of a particular tag name and namespace, from the current element.
  330. @throws DOMError
  331. **/
  332. @:pure
  333. function getElementsByTagNameNS( namespace : String, localName : String ) : HTMLCollection;
  334. /**
  335. Returns a live `HTMLCollection` that contains all descendants of the current element that possess the list of classes given in the parameter.
  336. **/
  337. @:pure
  338. function getElementsByClassName( classNames : String ) : HTMLCollection;
  339. /**
  340. Inserts a given element node at a given position relative to the element it is invoked upon.
  341. @throws DOMError
  342. **/
  343. @:pure
  344. function insertAdjacentElement( where : String, element : Element ) : Element;
  345. /**
  346. Inserts a given text node at a given position relative to the element it is invoked upon.
  347. @throws DOMError
  348. **/
  349. function insertAdjacentText( where : String, data : String ) : Void;
  350. /**
  351. Designates a specific element as the capture target of future pointer events.
  352. @throws DOMError
  353. **/
  354. function setPointerCapture( pointerId : Int ) : Void;
  355. /**
  356. Releases (stops) pointer capture that was previously set for a specific `PointerEvent`.
  357. @throws DOMError
  358. **/
  359. function releasePointerCapture( pointerId : Int ) : Void;
  360. function hasPointerCapture( pointerId : Int ) : Bool;
  361. /**
  362. Sets up mouse event capture, redirecting all mouse events to this element.
  363. **/
  364. function setCapture( retargetToElement : Bool = false ) : Void;
  365. function releaseCapture() : Void;
  366. /**
  367. Retrieves the node representation of the named attribute from the current node and returns it as an `Attr`.
  368. **/
  369. function getAttributeNode( name : String ) : Attr;
  370. /**
  371. Sets the node representation of the named attribute from the current node.
  372. @throws DOMError
  373. **/
  374. function setAttributeNode( newAttr : Attr ) : Attr;
  375. /**
  376. Removes the node representation of the named attribute from the current node.
  377. @throws DOMError
  378. **/
  379. function removeAttributeNode( oldAttr : Attr ) : Attr;
  380. /**
  381. Retrieves the node representation of the attribute with the specified name and namespace, from the current node and returns it as an `Attr`.
  382. **/
  383. function getAttributeNodeNS( namespaceURI : String, localName : String ) : Attr;
  384. /**
  385. Sets the node representation of the attribute with the specified name and namespace, from the current node.
  386. @throws DOMError
  387. **/
  388. function setAttributeNodeNS( newAttr : Attr ) : Attr;
  389. function click() : Void;
  390. /** @throws DOMError */
  391. function focus() : Void;
  392. /** @throws DOMError */
  393. function blur() : Void;
  394. /**
  395. Returns a collection of rectangles that indicate the bounding rectangles for each line of text in a client.
  396. **/
  397. function getClientRects() : DOMRectList;
  398. /**
  399. Returns the size of an element and its position relative to the viewport.
  400. **/
  401. function getBoundingClientRect() : DOMRect;
  402. /**
  403. Scrolls the page until the element gets into the view.
  404. **/
  405. @:overload( function( ?arg : ScrollIntoViewOptions) : Void {} )
  406. function scrollIntoView( ?arg : Bool ) : Void;
  407. @:overload( function( x : Float, y : Float ) : Void {} )
  408. function scroll( ?options : ScrollToOptions ) : Void;
  409. @:overload( function( x : Float, y : Float ) : Void {} )
  410. function scrollTo( ?options : ScrollToOptions ) : Void;
  411. @:overload( function( x : Float, y : Float ) : Void {} )
  412. function scrollBy( ?options : ScrollToOptions ) : Void;
  413. /**
  414. Parses the text as HTML or XML and inserts the resulting nodes into the tree in the position given.
  415. @throws DOMError
  416. **/
  417. function insertAdjacentHTML( position : String, text : String ) : Void;
  418. /**
  419. Returns the first `Node` which matches the specified selector string relative to the element.
  420. @throws DOMError
  421. **/
  422. @:pure
  423. function querySelector( selectors : String ) : Element;
  424. /**
  425. Returns a `NodeList` of nodes which match the specified selector string relative to the element.
  426. @throws DOMError
  427. **/
  428. @:pure
  429. function querySelectorAll( selectors : String ) : NodeList;
  430. /**
  431. Attatches a shadow DOM tree to the specified element and returns a reference to its `ShadowRoot`.
  432. @throws DOMError
  433. **/
  434. function attachShadow( shadowRootInitDict : ShadowRootInit ) : ShadowRoot;
  435. /**
  436. Asynchronously asks the browser to make the element full-screen.
  437. @throws DOMError
  438. **/
  439. function requestFullscreen() : Void;
  440. /**
  441. Allows to asynchronously ask for the pointer to be locked on the given element.
  442. **/
  443. function requestPointerLock() : Void;
  444. /**
  445. A shortcut method to create and run an animation on an element. Returns the created Animation object instance.
  446. @throws DOMError
  447. **/
  448. @:overload( function( keyframes : Dynamic, ?options : KeyframeAnimationOptions) : Animation {} )
  449. function animate( keyframes : Dynamic, ?options : Float ) : Animation;
  450. /**
  451. Returns an array of Animation objects currently active on the element.
  452. **/
  453. function getAnimations( ?filter : AnimationFilter ) : Array<Animation>;
  454. /** @throws DOMError */
  455. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  456. function before( nodes : haxe.extern.Rest<Node> ) : Void;
  457. /** @throws DOMError */
  458. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  459. function after( nodes : haxe.extern.Rest<Node> ) : Void;
  460. /** @throws DOMError */
  461. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  462. function replaceWith( nodes : haxe.extern.Rest<Node> ) : Void;
  463. function remove() : Void;
  464. /** @throws DOMError */
  465. @:overload( function( quad : DOMQuad, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  466. @:overload( function( quad : DOMQuad, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  467. function convertQuadFromNode( quad : DOMQuad, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  468. /** @throws DOMError */
  469. @:overload( function( rect : DOMRectReadOnly, from : Element, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  470. @:overload( function( rect : DOMRectReadOnly, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMQuad {} )
  471. function convertRectFromNode( rect : DOMRectReadOnly, from : Text, ?options : ConvertCoordinateOptions ) : DOMQuad;
  472. /** @throws DOMError */
  473. @:overload( function( point : DOMPointInit, from : Element, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  474. @:overload( function( point : DOMPointInit, from : HTMLDocument, ?options : ConvertCoordinateOptions) : DOMPoint {} )
  475. function convertPointFromNode( point : DOMPointInit, from : Text, ?options : ConvertCoordinateOptions ) : DOMPoint;
  476. /** @throws DOMError */
  477. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  478. function prepend( nodes : haxe.extern.Rest<Node> ) : Void;
  479. /** @throws DOMError */
  480. @:overload( function( nodes : haxe.extern.Rest<String>) : Void {} )
  481. function append( nodes : haxe.extern.Rest<Node> ) : Void;
  482. }