Range.hx 6.0 KB

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