Skip to main content

web_sys/features/
gen_Selection.rs

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