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