1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = Selection , typescript_type = "Selection")]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `Selection` class."]
10 #[doc = ""]
11 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection)"]
12 #[doc = ""]
13 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
14 pub type Selection;
15 #[cfg(feature = "Node")]
16 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = anchorNode)]
17 #[doc = "Getter for the `anchorNode` field of this object."]
18 #[doc = ""]
19 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/anchorNode)"]
20 #[doc = ""]
21 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
22 pub fn anchor_node(this: &Selection) -> Option<Node>;
23 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = anchorOffset)]
24 #[doc = "Getter for the `anchorOffset` field of this object."]
25 #[doc = ""]
26 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/anchorOffset)"]
27 #[doc = ""]
28 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
29 pub fn anchor_offset(this: &Selection) -> u32;
30 #[cfg(feature = "Node")]
31 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = focusNode)]
32 #[doc = "Getter for the `focusNode` field of this object."]
33 #[doc = ""]
34 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/focusNode)"]
35 #[doc = ""]
36 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
37 pub fn focus_node(this: &Selection) -> Option<Node>;
38 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = focusOffset)]
39 #[doc = "Getter for the `focusOffset` field of this object."]
40 #[doc = ""]
41 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/focusOffset)"]
42 #[doc = ""]
43 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
44 pub fn focus_offset(this: &Selection) -> u32;
45 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = isCollapsed)]
46 #[doc = "Getter for the `isCollapsed` field of this object."]
47 #[doc = ""]
48 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/isCollapsed)"]
49 #[doc = ""]
50 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
51 pub fn is_collapsed(this: &Selection) -> bool;
52 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = rangeCount)]
53 #[doc = "Getter for the `rangeCount` field of this object."]
54 #[doc = ""]
55 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/rangeCount)"]
56 #[doc = ""]
57 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
58 pub fn range_count(this: &Selection) -> u32;
59 # [wasm_bindgen (structural , method , getter , js_class = "Selection" , js_name = type)]
60 #[doc = "Getter for the `type` field of this object."]
61 #[doc = ""]
62 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/type)"]
63 #[doc = ""]
64 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
65 pub fn type_(this: &Selection) -> ::alloc::string::String;
66 # [wasm_bindgen (structural , catch , method , getter , js_class = "Selection" , js_name = caretBidiLevel)]
67 #[doc = "Getter for the `caretBidiLevel` field of this object."]
68 #[doc = ""]
69 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/caretBidiLevel)"]
70 #[doc = ""]
71 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
72 pub fn caret_bidi_level(this: &Selection) -> Result<Option<i16>, JsValue>;
73 # [wasm_bindgen (structural , catch , method , setter , js_class = "Selection" , js_name = caretBidiLevel)]
74 #[doc = "Setter for the `caretBidiLevel` field of this object."]
75 #[doc = ""]
76 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/caretBidiLevel)"]
77 #[doc = ""]
78 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
79 pub fn set_caret_bidi_level(this: &Selection, value: Option<i16>) -> Result<(), JsValue>;
80 #[cfg(feature = "Range")]
81 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = addRange)]
82 #[doc = "The `addRange()` method."]
83 #[doc = ""]
84 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/addRange)"]
85 #[doc = ""]
86 #[doc = "*This API requires the following crate features to be activated: `Range`, `Selection`*"]
87 pub fn add_range(this: &Selection, range: &Range) -> Result<(), JsValue>;
88 #[cfg(feature = "Node")]
89 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = collapse)]
90 #[doc = "The `collapse()` method."]
91 #[doc = ""]
92 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/collapse)"]
93 #[doc = ""]
94 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
95 pub fn collapse(this: &Selection, node: Option<&Node>) -> Result<(), JsValue>;
96 #[cfg(feature = "Node")]
97 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = collapse)]
98 #[doc = "The `collapse()` method."]
99 #[doc = ""]
100 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/collapse)"]
101 #[doc = ""]
102 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
103 pub fn collapse_with_offset(
104 this: &Selection,
105 node: Option<&Node>,
106 offset: u32,
107 ) -> Result<(), JsValue>;
108 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = collapseToEnd)]
109 #[doc = "The `collapseToEnd()` method."]
110 #[doc = ""]
111 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/collapseToEnd)"]
112 #[doc = ""]
113 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
114 pub fn collapse_to_end(this: &Selection) -> Result<(), JsValue>;
115 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = collapseToStart)]
116 #[doc = "The `collapseToStart()` method."]
117 #[doc = ""]
118 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/collapseToStart)"]
119 #[doc = ""]
120 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
121 pub fn collapse_to_start(this: &Selection) -> Result<(), JsValue>;
122 #[cfg(feature = "Node")]
123 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = containsNode)]
124 #[doc = "The `containsNode()` method."]
125 #[doc = ""]
126 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/containsNode)"]
127 #[doc = ""]
128 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
129 pub fn contains_node(this: &Selection, node: &Node) -> Result<bool, JsValue>;
130 #[cfg(feature = "Node")]
131 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = containsNode)]
132 #[doc = "The `containsNode()` method."]
133 #[doc = ""]
134 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/containsNode)"]
135 #[doc = ""]
136 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
137 pub fn contains_node_with_allow_partial_containment(
138 this: &Selection,
139 node: &Node,
140 allow_partial_containment: bool,
141 ) -> Result<bool, JsValue>;
142 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = deleteFromDocument)]
143 #[doc = "The `deleteFromDocument()` method."]
144 #[doc = ""]
145 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/deleteFromDocument)"]
146 #[doc = ""]
147 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
148 pub fn delete_from_document(this: &Selection) -> Result<(), JsValue>;
149 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = empty)]
150 #[doc = "The `empty()` method."]
151 #[doc = ""]
152 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/empty)"]
153 #[doc = ""]
154 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
155 pub fn empty(this: &Selection) -> Result<(), JsValue>;
156 #[cfg(feature = "Node")]
157 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = extend)]
158 #[doc = "The `extend()` method."]
159 #[doc = ""]
160 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/extend)"]
161 #[doc = ""]
162 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
163 pub fn extend(this: &Selection, node: &Node) -> Result<(), JsValue>;
164 #[cfg(feature = "Node")]
165 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = extend)]
166 #[doc = "The `extend()` method."]
167 #[doc = ""]
168 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/extend)"]
169 #[doc = ""]
170 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
171 pub fn extend_with_offset(this: &Selection, node: &Node, offset: u32) -> Result<(), JsValue>;
172 #[cfg(feature = "Range")]
173 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = getRangeAt)]
174 #[doc = "The `getRangeAt()` method."]
175 #[doc = ""]
176 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/getRangeAt)"]
177 #[doc = ""]
178 #[doc = "*This API requires the following crate features to be activated: `Range`, `Selection`*"]
179 pub fn get_range_at(this: &Selection, index: u32) -> Result<Range, JsValue>;
180 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = modify)]
181 #[doc = "The `modify()` method."]
182 #[doc = ""]
183 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/modify)"]
184 #[doc = ""]
185 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
186 pub fn modify(
187 this: &Selection,
188 alter: &str,
189 direction: &str,
190 granularity: &str,
191 ) -> Result<(), JsValue>;
192 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = removeAllRanges)]
193 #[doc = "The `removeAllRanges()` method."]
194 #[doc = ""]
195 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/removeAllRanges)"]
196 #[doc = ""]
197 #[doc = "*This API requires the following crate features to be activated: `Selection`*"]
198 pub fn remove_all_ranges(this: &Selection) -> Result<(), JsValue>;
199 #[cfg(feature = "Range")]
200 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = removeRange)]
201 #[doc = "The `removeRange()` method."]
202 #[doc = ""]
203 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/removeRange)"]
204 #[doc = ""]
205 #[doc = "*This API requires the following crate features to be activated: `Range`, `Selection`*"]
206 pub fn remove_range(this: &Selection, range: &Range) -> Result<(), JsValue>;
207 #[cfg(feature = "Node")]
208 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = selectAllChildren)]
209 #[doc = "The `selectAllChildren()` method."]
210 #[doc = ""]
211 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/selectAllChildren)"]
212 #[doc = ""]
213 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
214 pub fn select_all_children(this: &Selection, node: &Node) -> Result<(), JsValue>;
215 #[cfg(feature = "Node")]
216 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = setBaseAndExtent)]
217 #[doc = "The `setBaseAndExtent()` method."]
218 #[doc = ""]
219 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/setBaseAndExtent)"]
220 #[doc = ""]
221 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
222 pub fn set_base_and_extent(
223 this: &Selection,
224 anchor_node: &Node,
225 anchor_offset: u32,
226 focus_node: &Node,
227 focus_offset: u32,
228 ) -> Result<(), JsValue>;
229 #[cfg(feature = "Node")]
230 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = setPosition)]
231 #[doc = "The `setPosition()` method."]
232 #[doc = ""]
233 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/setPosition)"]
234 #[doc = ""]
235 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
236 pub fn set_position(this: &Selection, node: Option<&Node>) -> Result<(), JsValue>;
237 #[cfg(feature = "Node")]
238 # [wasm_bindgen (catch , method , structural , js_class = "Selection" , js_name = setPosition)]
239 #[doc = "The `setPosition()` method."]
240 #[doc = ""]
241 #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Selection/setPosition)"]
242 #[doc = ""]
243 #[doc = "*This API requires the following crate features to be activated: `Node`, `Selection`*"]
244 pub fn set_position_with_offset(
245 this: &Selection,
246 node: Option<&Node>,
247 offset: u32,
248 ) -> Result<(), JsValue>;
249}