Skip to main content

web_sys/features/
gen_Range.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 = "AbstractRange",
9        extends = "::js_sys::Object",
10        js_name = "Range",
11        typescript_type = "Range"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `Range` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
19    pub type Range;
20    #[cfg(feature = "Node")]
21    #[wasm_bindgen(catch, method, getter, js_class = "Range", js_name = "startContainer")]
22    #[doc = "Getter for the `startContainer` field of this object."]
23    #[doc = ""]
24    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/startContainer)"]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
27    pub fn start_container(this: &Range) -> Result<Node, JsValue>;
28    #[wasm_bindgen(catch, method, getter, js_class = "Range", js_name = "startOffset")]
29    #[doc = "Getter for the `startOffset` field of this object."]
30    #[doc = ""]
31    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset)"]
32    #[doc = ""]
33    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
34    pub fn start_offset(this: &Range) -> Result<u32, JsValue>;
35    #[cfg(feature = "Node")]
36    #[wasm_bindgen(catch, method, getter, js_class = "Range", js_name = "endContainer")]
37    #[doc = "Getter for the `endContainer` field of this object."]
38    #[doc = ""]
39    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/endContainer)"]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
42    pub fn end_container(this: &Range) -> Result<Node, JsValue>;
43    #[wasm_bindgen(catch, method, getter, js_class = "Range", js_name = "endOffset")]
44    #[doc = "Getter for the `endOffset` field of this object."]
45    #[doc = ""]
46    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset)"]
47    #[doc = ""]
48    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
49    pub fn end_offset(this: &Range) -> Result<u32, JsValue>;
50    #[wasm_bindgen(method, getter, js_class = "Range", js_name = "collapsed")]
51    #[doc = "Getter for the `collapsed` field of this object."]
52    #[doc = ""]
53    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapsed)"]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
56    pub fn collapsed(this: &Range) -> bool;
57    #[cfg(feature = "Node")]
58    #[wasm_bindgen(
59        catch,
60        method,
61        getter,
62        js_class = "Range",
63        js_name = "commonAncestorContainer"
64    )]
65    #[doc = "Getter for the `commonAncestorContainer` field of this object."]
66    #[doc = ""]
67    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/commonAncestorContainer)"]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
70    pub fn common_ancestor_container(this: &Range) -> Result<Node, JsValue>;
71    #[wasm_bindgen(catch, constructor, js_class = "Range")]
72    #[doc = "The `new Range(..)` constructor, creating a new instance of `Range`."]
73    #[doc = ""]
74    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/Range)"]
75    #[doc = ""]
76    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
77    pub fn new() -> Result<Range, JsValue>;
78    #[cfg(feature = "DocumentFragment")]
79    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "cloneContents")]
80    #[doc = "The `cloneContents()` method."]
81    #[doc = ""]
82    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneContents)"]
83    #[doc = ""]
84    #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`, `Range`*"]
85    pub fn clone_contents(this: &Range) -> Result<DocumentFragment, JsValue>;
86    #[wasm_bindgen(method, js_class = "Range", js_name = "cloneRange")]
87    #[doc = "The `cloneRange()` method."]
88    #[doc = ""]
89    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneRange)"]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
92    pub fn clone_range(this: &Range) -> Range;
93    #[wasm_bindgen(method, js_class = "Range")]
94    #[doc = "The `collapse()` method."]
95    #[doc = ""]
96    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapse)"]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
99    pub fn collapse(this: &Range);
100    #[wasm_bindgen(method, js_class = "Range", js_name = "collapse")]
101    #[doc = "The `collapse()` method."]
102    #[doc = ""]
103    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapse)"]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
106    pub fn collapse_with_to_start(this: &Range, to_start: bool);
107    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "compareBoundaryPoints")]
108    #[doc = "The `compareBoundaryPoints()` method."]
109    #[doc = ""]
110    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/compareBoundaryPoints)"]
111    #[doc = ""]
112    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
113    pub fn compare_boundary_points(
114        this: &Range,
115        how: u16,
116        source_range: &Range,
117    ) -> Result<i16, JsValue>;
118    #[cfg(feature = "Node")]
119    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "comparePoint")]
120    #[doc = "The `comparePoint()` method."]
121    #[doc = ""]
122    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/comparePoint)"]
123    #[doc = ""]
124    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
125    pub fn compare_point(this: &Range, node: &Node, offset: u32) -> Result<i16, JsValue>;
126    #[cfg(feature = "DocumentFragment")]
127    #[wasm_bindgen(
128        catch,
129        method,
130        js_class = "Range",
131        js_name = "createContextualFragment"
132    )]
133    #[doc = "The `createContextualFragment()` method."]
134    #[doc = ""]
135    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/createContextualFragment)"]
136    #[doc = ""]
137    #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`, `Range`*"]
138    pub fn create_contextual_fragment(
139        this: &Range,
140        fragment: &str,
141    ) -> Result<DocumentFragment, JsValue>;
142    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "deleteContents")]
143    #[doc = "The `deleteContents()` method."]
144    #[doc = ""]
145    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/deleteContents)"]
146    #[doc = ""]
147    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
148    pub fn delete_contents(this: &Range) -> Result<(), JsValue>;
149    #[wasm_bindgen(method, js_class = "Range")]
150    #[doc = "The `detach()` method."]
151    #[doc = ""]
152    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/detach)"]
153    #[doc = ""]
154    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
155    pub fn detach(this: &Range);
156    #[cfg(feature = "DocumentFragment")]
157    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "extractContents")]
158    #[doc = "The `extractContents()` method."]
159    #[doc = ""]
160    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents)"]
161    #[doc = ""]
162    #[doc = "*This API requires the following crate features to be activated: `DocumentFragment`, `Range`*"]
163    pub fn extract_contents(this: &Range) -> Result<DocumentFragment, JsValue>;
164    #[cfg(feature = "DomRect")]
165    #[wasm_bindgen(method, js_class = "Range", js_name = "getBoundingClientRect")]
166    #[doc = "The `getBoundingClientRect()` method."]
167    #[doc = ""]
168    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/getBoundingClientRect)"]
169    #[doc = ""]
170    #[doc = "*This API requires the following crate features to be activated: `DomRect`, `Range`*"]
171    pub fn get_bounding_client_rect(this: &Range) -> DomRect;
172    #[cfg(feature = "DomRectList")]
173    #[wasm_bindgen(method, js_class = "Range", js_name = "getClientRects")]
174    #[doc = "The `getClientRects()` method."]
175    #[doc = ""]
176    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/getClientRects)"]
177    #[doc = ""]
178    #[doc = "*This API requires the following crate features to be activated: `DomRectList`, `Range`*"]
179    pub fn get_client_rects(this: &Range) -> Option<DomRectList>;
180    #[cfg(feature = "Node")]
181    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "insertNode")]
182    #[doc = "The `insertNode()` method."]
183    #[doc = ""]
184    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/insertNode)"]
185    #[doc = ""]
186    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
187    pub fn insert_node(this: &Range, node: &Node) -> Result<(), JsValue>;
188    #[cfg(feature = "Node")]
189    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "intersectsNode")]
190    #[doc = "The `intersectsNode()` method."]
191    #[doc = ""]
192    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/intersectsNode)"]
193    #[doc = ""]
194    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
195    pub fn intersects_node(this: &Range, node: &Node) -> Result<bool, JsValue>;
196    #[cfg(feature = "Node")]
197    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "isPointInRange")]
198    #[doc = "The `isPointInRange()` method."]
199    #[doc = ""]
200    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/isPointInRange)"]
201    #[doc = ""]
202    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
203    pub fn is_point_in_range(this: &Range, node: &Node, offset: u32) -> Result<bool, JsValue>;
204    #[cfg(feature = "Node")]
205    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "selectNode")]
206    #[doc = "The `selectNode()` method."]
207    #[doc = ""]
208    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNode)"]
209    #[doc = ""]
210    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
211    pub fn select_node(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
212    #[cfg(feature = "Node")]
213    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "selectNodeContents")]
214    #[doc = "The `selectNodeContents()` method."]
215    #[doc = ""]
216    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNodeContents)"]
217    #[doc = ""]
218    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
219    pub fn select_node_contents(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
220    #[cfg(feature = "Node")]
221    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setEnd")]
222    #[doc = "The `setEnd()` method."]
223    #[doc = ""]
224    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEnd)"]
225    #[doc = ""]
226    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
227    pub fn set_end(this: &Range, ref_node: &Node, offset: u32) -> Result<(), JsValue>;
228    #[cfg(feature = "Node")]
229    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setEndAfter")]
230    #[doc = "The `setEndAfter()` method."]
231    #[doc = ""]
232    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndAfter)"]
233    #[doc = ""]
234    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
235    pub fn set_end_after(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
236    #[cfg(feature = "Node")]
237    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setEndBefore")]
238    #[doc = "The `setEndBefore()` method."]
239    #[doc = ""]
240    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndBefore)"]
241    #[doc = ""]
242    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
243    pub fn set_end_before(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
244    #[cfg(feature = "Node")]
245    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setStart")]
246    #[doc = "The `setStart()` method."]
247    #[doc = ""]
248    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStart)"]
249    #[doc = ""]
250    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
251    pub fn set_start(this: &Range, ref_node: &Node, offset: u32) -> Result<(), JsValue>;
252    #[cfg(feature = "Node")]
253    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setStartAfter")]
254    #[doc = "The `setStartAfter()` method."]
255    #[doc = ""]
256    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartAfter)"]
257    #[doc = ""]
258    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
259    pub fn set_start_after(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
260    #[cfg(feature = "Node")]
261    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "setStartBefore")]
262    #[doc = "The `setStartBefore()` method."]
263    #[doc = ""]
264    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartBefore)"]
265    #[doc = ""]
266    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
267    pub fn set_start_before(this: &Range, ref_node: &Node) -> Result<(), JsValue>;
268    #[cfg(feature = "Node")]
269    #[wasm_bindgen(catch, method, js_class = "Range", js_name = "surroundContents")]
270    #[doc = "The `surroundContents()` method."]
271    #[doc = ""]
272    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents)"]
273    #[doc = ""]
274    #[doc = "*This API requires the following crate features to be activated: `Node`, `Range`*"]
275    pub fn surround_contents(this: &Range, new_parent: &Node) -> Result<(), JsValue>;
276}
277impl Range {
278    #[doc = "The `Range.START_TO_START` const."]
279    #[doc = ""]
280    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
281    pub const START_TO_START: u16 = 0i64 as u16;
282    #[doc = "The `Range.START_TO_END` const."]
283    #[doc = ""]
284    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
285    pub const START_TO_END: u16 = 1u64 as u16;
286    #[doc = "The `Range.END_TO_END` const."]
287    #[doc = ""]
288    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
289    pub const END_TO_END: u16 = 2u64 as u16;
290    #[doc = "The `Range.END_TO_START` const."]
291    #[doc = ""]
292    #[doc = "*This API requires the following crate features to be activated: `Range`*"]
293    pub const END_TO_START: u16 = 3u64 as u16;
294}