Selection.hx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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\Selection.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. A `Selection` object represents the range of text selected by the user or the current position of the caret. To obtain a Selection object for examination or modification, call `window.getSelection()`.
  26. Documentation [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/Selection$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/Selection>
  28. **/
  29. @:native("Selection")
  30. extern class Selection {
  31. /**
  32. Returns the `Node` in which the selection begins.
  33. **/
  34. var anchorNode(default,null) : Node;
  35. /**
  36. Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of characters within anchorNode preceding the anchor. If anchorNode is an element, this is the number of child nodes of the anchorNode preceding the anchor.
  37. **/
  38. var anchorOffset(default,null) : Int;
  39. /**
  40. Returns the `Node` in which the selection ends.
  41. **/
  42. var focusNode(default,null) : Node;
  43. /**
  44. Returns a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus.
  45. **/
  46. var focusOffset(default,null) : Int;
  47. /**
  48. Returns a Boolean indicating whether the selection's start and end points are at the same position.
  49. **/
  50. var isCollapsed(default,null) : Bool;
  51. /**
  52. Returns the number of ranges in the selection.
  53. **/
  54. var rangeCount(default,null) : Int;
  55. /**
  56. Returns a `DOMString` describing the type of the current selection.
  57. **/
  58. var type(default,null) : String;
  59. var caretBidiLevel : Int;
  60. /**
  61. Returns a `Range` object representing one of the ranges currently selected.
  62. @throws DOMError
  63. **/
  64. function getRangeAt( index : Int ) : Range;
  65. /**
  66. A `Range` object that will be added to the selection.
  67. @throws DOMError
  68. **/
  69. function addRange( range : Range ) : Void;
  70. /**
  71. Removes a range from the selection.
  72. @throws DOMError
  73. **/
  74. function removeRange( range : Range ) : Void;
  75. /**
  76. Removes all ranges from the selection.
  77. @throws DOMError
  78. **/
  79. function removeAllRanges() : Void;
  80. /** @throws DOMError */
  81. function empty() : Void;
  82. /**
  83. Collapses the current selection to a single point.
  84. @throws DOMError
  85. **/
  86. function collapse( node : Node, offset : Int = 0 ) : Void;
  87. /** @throws DOMError */
  88. function setPosition( node : Node, offset : Int = 0 ) : Void;
  89. /**
  90. Collapses the selection to the start of the first range in the selection.
  91. @throws DOMError
  92. **/
  93. function collapseToStart() : Void;
  94. /**
  95. Collapses the selection to the end of the last range in the selection.
  96. @throws DOMError
  97. **/
  98. function collapseToEnd() : Void;
  99. /**
  100. Moves the focus of the selection to a specified point.
  101. @throws DOMError
  102. **/
  103. function extend( node : Node, offset : Int = 0 ) : Void;
  104. /**
  105. Sets the selection to be a range including all or parts of two specified DOM nodes, and any content located between them.
  106. @throws DOMError
  107. **/
  108. function setBaseAndExtent( anchorNode : Node, anchorOffset : Int, focusNode : Node, focusOffset : Int ) : Void;
  109. /**
  110. Adds all the children of the specified node to the selection.
  111. @throws DOMError
  112. **/
  113. function selectAllChildren( node : Node ) : Void;
  114. /**
  115. Deletes the selection's content from the document.
  116. @throws DOMError
  117. **/
  118. function deleteFromDocument() : Void;
  119. /**
  120. Indicates if a certain node is part of the selection.
  121. @throws DOMError
  122. **/
  123. function containsNode( node : Node, allowPartialContainment : Bool = false ) : Bool;
  124. /**
  125. Changes the current selection.
  126. @throws DOMError
  127. **/
  128. function modify( alter : String, direction : String, granularity : String ) : Void;
  129. }