Range.hx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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\Range.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `Range` interface represents a fragment of a document that can contain nodes and parts of text nodes.
  26. Documentation [Range](https://developer.mozilla.org/en-US/docs/Web/API/Range) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Range$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/Range>
  28. **/
  29. @:native("Range")
  30. extern class Range
  31. {
  32. static inline var START_TO_START : Int = 0;
  33. static inline var START_TO_END : Int = 1;
  34. static inline var END_TO_END : Int = 2;
  35. static inline var END_TO_START : Int = 3;
  36. /**
  37. Returns the `Node` within which the `Range` starts.
  38. **/
  39. var startContainer(default,null) : Node;
  40. /**
  41. Returns a number representing where in the `startContainer` the `Range` starts.
  42. **/
  43. var startOffset(default,null) : Int;
  44. /**
  45. Returns the `Node` within which the `Range` ends.
  46. **/
  47. var endContainer(default,null) : Node;
  48. /**
  49. Returns a number representing where in the `endContainer` the `Range` ends.
  50. **/
  51. var endOffset(default,null) : Int;
  52. /**
  53. Returns a `Boolean` indicating whether the range's start and end points are at the same position.
  54. **/
  55. var collapsed(default,null) : Bool;
  56. /**
  57. Returns the deepest `Node` that contains the `startContainer` and `endContainer` nodes.
  58. **/
  59. var commonAncestorContainer(default,null) : Node;
  60. /** @throws DOMError */
  61. function new() : Void;
  62. /**
  63. Sets the start position of a `Range`.
  64. @throws DOMError
  65. **/
  66. function setStart( refNode : Node, offset : Int ) : Void;
  67. /**
  68. Sets the end position of a `Range`.
  69. @throws DOMError
  70. **/
  71. function setEnd( refNode : Node, offset : Int ) : Void;
  72. /**
  73. Sets the start position of a `Range` relative to another `Node`.
  74. @throws DOMError
  75. **/
  76. function setStartBefore( refNode : Node ) : Void;
  77. /**
  78. Sets the start position of a `Range` relative to another `Node`.
  79. @throws DOMError
  80. **/
  81. function setStartAfter( refNode : Node ) : Void;
  82. /**
  83. Sets the end position of a `Range` relative to another `Node`.
  84. @throws DOMError
  85. **/
  86. function setEndBefore( refNode : Node ) : Void;
  87. /**
  88. Sets the end position of a `Range` relative to another `Node`.
  89. @throws DOMError
  90. **/
  91. function setEndAfter( refNode : Node ) : Void;
  92. /**
  93. Collapses the `Range` to one of its boundary points.
  94. **/
  95. function collapse( ?toStart : Bool = false ) : Void;
  96. /**
  97. Sets the `Range` to contain the `Node` and its contents.
  98. @throws DOMError
  99. **/
  100. function selectNode( refNode : Node ) : Void;
  101. /**
  102. Sets the `Range` to contain the contents of a `Node`.
  103. @throws DOMError
  104. **/
  105. function selectNodeContents( refNode : Node ) : Void;
  106. /**
  107. Compares the boundary points of the `Range` with another `Range`.
  108. @throws DOMError
  109. **/
  110. function compareBoundaryPoints( how : Int, sourceRange : Range ) : Int;
  111. /**
  112. Removes the contents of a `Range` from the `Document`.
  113. @throws DOMError
  114. **/
  115. function deleteContents() : Void;
  116. /**
  117. Moves contents of a `Range` from the document tree into a `DocumentFragment`.
  118. @throws DOMError
  119. **/
  120. function extractContents() : DocumentFragment;
  121. /**
  122. Returns a `DocumentFragment` copying the nodes of a `Range`.
  123. @throws DOMError
  124. **/
  125. function cloneContents() : DocumentFragment;
  126. /**
  127. Insert a `Node` at the start of a `Range`.
  128. @throws DOMError
  129. **/
  130. function insertNode( node : Node ) : Void;
  131. /**
  132. Moves content of a `Range` into a new `Node`.
  133. @throws DOMError
  134. **/
  135. function surroundContents( newParent : Node ) : Void;
  136. /**
  137. Returns a `Range` object with boundary points identical to the cloned `Range`.
  138. **/
  139. function cloneRange() : Range;
  140. /**
  141. Releases the `Range` from use to improve performance.
  142. **/
  143. function detach() : Void;
  144. /**
  145. Returns a `boolean` indicating whether the given point is in the `Range`.
  146. @throws DOMError
  147. **/
  148. function isPointInRange( node : Node, offset : Int ) : Bool;
  149. /**
  150. Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the `Range`.
  151. @throws DOMError
  152. **/
  153. function comparePoint( node : Node, offset : Int ) : Int;
  154. /**
  155. Returns a `boolean` indicating whether the given node intersects the `Range`.
  156. @throws DOMError
  157. **/
  158. function intersectsNode( node : Node ) : Bool;
  159. /**
  160. Returns a `DocumentFragment` created from a given string of code.
  161. @throws DOMError
  162. **/
  163. function createContextualFragment( fragment : String ) : DocumentFragment;
  164. /**
  165. Returns a list of `DOMRect` objects that aggregates the results of `Element.getClientRects()` for all the elements in the `Range`.
  166. **/
  167. function getClientRects() : DOMRectList;
  168. /**
  169. Returns a `DOMRect` object which bounds the entire contents of the `Range`; this would be the union of all the rectangles returned by `range.getClientRects()`.
  170. **/
  171. function getBoundingClientRect() : DOMRect;
  172. }