Skip to main content

web_sys/features/
gen_Node.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 = "EventTarget",
9        extends = "::js_sys::Object",
10        js_name = "Node",
11        typescript_type = "Node"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `Node` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
19    pub type Node;
20    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "nodeType")]
21    #[doc = "Getter for the `nodeType` field of this object."]
22    #[doc = ""]
23    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType)"]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
26    pub fn node_type(this: &Node) -> u16;
27    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "nodeName")]
28    #[doc = "Getter for the `nodeName` field of this object."]
29    #[doc = ""]
30    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName)"]
31    #[doc = ""]
32    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
33    pub fn node_name(this: &Node) -> ::alloc::string::String;
34    #[wasm_bindgen(catch, method, getter, js_class = "Node", js_name = "baseURI")]
35    #[doc = "Getter for the `baseURI` field of this object."]
36    #[doc = ""]
37    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI)"]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
40    pub fn base_uri(this: &Node) -> Result<Option<::alloc::string::String>, JsValue>;
41    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "isConnected")]
42    #[doc = "Getter for the `isConnected` field of this object."]
43    #[doc = ""]
44    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected)"]
45    #[doc = ""]
46    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
47    pub fn is_connected(this: &Node) -> bool;
48    #[cfg(feature = "Document")]
49    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "ownerDocument")]
50    #[doc = "Getter for the `ownerDocument` field of this object."]
51    #[doc = ""]
52    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument)"]
53    #[doc = ""]
54    #[doc = "*This API requires the following crate features to be activated: `Document`, `Node`*"]
55    pub fn owner_document(this: &Node) -> Option<Document>;
56    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "parentNode")]
57    #[doc = "Getter for the `parentNode` field of this object."]
58    #[doc = ""]
59    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode)"]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
62    pub fn parent_node(this: &Node) -> Option<Node>;
63    #[cfg(feature = "Element")]
64    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "parentElement")]
65    #[doc = "Getter for the `parentElement` field of this object."]
66    #[doc = ""]
67    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement)"]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `Element`, `Node`*"]
70    pub fn parent_element(this: &Node) -> Option<Element>;
71    #[cfg(feature = "NodeList")]
72    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "childNodes")]
73    #[doc = "Getter for the `childNodes` field of this object."]
74    #[doc = ""]
75    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)"]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `Node`, `NodeList`*"]
78    pub fn child_nodes(this: &Node) -> NodeList;
79    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "firstChild")]
80    #[doc = "Getter for the `firstChild` field of this object."]
81    #[doc = ""]
82    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/firstChild)"]
83    #[doc = ""]
84    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
85    pub fn first_child(this: &Node) -> Option<Node>;
86    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "lastChild")]
87    #[doc = "Getter for the `lastChild` field of this object."]
88    #[doc = ""]
89    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild)"]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
92    pub fn last_child(this: &Node) -> Option<Node>;
93    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "previousSibling")]
94    #[doc = "Getter for the `previousSibling` field of this object."]
95    #[doc = ""]
96    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/previousSibling)"]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
99    pub fn previous_sibling(this: &Node) -> Option<Node>;
100    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "nextSibling")]
101    #[doc = "Getter for the `nextSibling` field of this object."]
102    #[doc = ""]
103    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)"]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
106    pub fn next_sibling(this: &Node) -> Option<Node>;
107    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "nodeValue")]
108    #[doc = "Getter for the `nodeValue` field of this object."]
109    #[doc = ""]
110    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)"]
111    #[doc = ""]
112    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
113    pub fn node_value(this: &Node) -> Option<::alloc::string::String>;
114    #[wasm_bindgen(method, setter, js_class = "Node", js_name = "nodeValue")]
115    #[doc = "Setter for the `nodeValue` field of this object."]
116    #[doc = ""]
117    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)"]
118    #[doc = ""]
119    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
120    pub fn set_node_value(this: &Node, value: Option<&str>);
121    #[wasm_bindgen(method, getter, js_class = "Node", js_name = "textContent")]
122    #[doc = "Getter for the `textContent` field of this object."]
123    #[doc = ""]
124    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)"]
125    #[doc = ""]
126    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
127    pub fn text_content(this: &Node) -> Option<::alloc::string::String>;
128    #[wasm_bindgen(method, setter, js_class = "Node", js_name = "textContent")]
129    #[doc = "Setter for the `textContent` field of this object."]
130    #[doc = ""]
131    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)"]
132    #[doc = ""]
133    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
134    pub fn set_text_content(this: &Node, value: Option<&str>);
135    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "appendChild")]
136    #[doc = "The `appendChild()` method."]
137    #[doc = ""]
138    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild)"]
139    #[doc = ""]
140    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
141    pub fn append_child(this: &Node, node: &Node) -> Result<Node, JsValue>;
142    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "cloneNode")]
143    #[doc = "The `cloneNode()` method."]
144    #[doc = ""]
145    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode)"]
146    #[doc = ""]
147    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
148    pub fn clone_node(this: &Node) -> Result<Node, JsValue>;
149    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "cloneNode")]
150    #[doc = "The `cloneNode()` method."]
151    #[doc = ""]
152    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode)"]
153    #[doc = ""]
154    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
155    pub fn clone_node_with_deep(this: &Node, deep: bool) -> Result<Node, JsValue>;
156    #[wasm_bindgen(method, js_class = "Node", js_name = "compareDocumentPosition")]
157    #[doc = "The `compareDocumentPosition()` method."]
158    #[doc = ""]
159    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition)"]
160    #[doc = ""]
161    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
162    pub fn compare_document_position(this: &Node, other: &Node) -> u16;
163    #[wasm_bindgen(method, js_class = "Node")]
164    #[doc = "The `contains()` method."]
165    #[doc = ""]
166    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains)"]
167    #[doc = ""]
168    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
169    pub fn contains(this: &Node, other: Option<&Node>) -> bool;
170    #[wasm_bindgen(method, js_class = "Node", js_name = "getRootNode")]
171    #[doc = "The `getRootNode()` method."]
172    #[doc = ""]
173    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)"]
174    #[doc = ""]
175    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
176    pub fn get_root_node(this: &Node) -> Node;
177    #[cfg(feature = "GetRootNodeOptions")]
178    #[wasm_bindgen(method, js_class = "Node", js_name = "getRootNode")]
179    #[doc = "The `getRootNode()` method."]
180    #[doc = ""]
181    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)"]
182    #[doc = ""]
183    #[doc = "*This API requires the following crate features to be activated: `GetRootNodeOptions`, `Node`*"]
184    pub fn get_root_node_with_options(this: &Node, options: &GetRootNodeOptions) -> Node;
185    #[wasm_bindgen(method, js_class = "Node", js_name = "hasChildNodes")]
186    #[doc = "The `hasChildNodes()` method."]
187    #[doc = ""]
188    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes)"]
189    #[doc = ""]
190    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
191    pub fn has_child_nodes(this: &Node) -> bool;
192    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "insertBefore")]
193    #[doc = "The `insertBefore()` method."]
194    #[doc = ""]
195    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore)"]
196    #[doc = ""]
197    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
198    pub fn insert_before(this: &Node, node: &Node, child: Option<&Node>) -> Result<Node, JsValue>;
199    #[wasm_bindgen(method, js_class = "Node", js_name = "isDefaultNamespace")]
200    #[doc = "The `isDefaultNamespace()` method."]
201    #[doc = ""]
202    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/isDefaultNamespace)"]
203    #[doc = ""]
204    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
205    pub fn is_default_namespace(this: &Node, namespace: Option<&str>) -> bool;
206    #[wasm_bindgen(method, js_class = "Node", js_name = "isEqualNode")]
207    #[doc = "The `isEqualNode()` method."]
208    #[doc = ""]
209    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode)"]
210    #[doc = ""]
211    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
212    pub fn is_equal_node(this: &Node, node: Option<&Node>) -> bool;
213    #[wasm_bindgen(method, js_class = "Node", js_name = "isSameNode")]
214    #[doc = "The `isSameNode()` method."]
215    #[doc = ""]
216    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode)"]
217    #[doc = ""]
218    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
219    pub fn is_same_node(this: &Node, node: Option<&Node>) -> bool;
220    #[wasm_bindgen(method, js_class = "Node", js_name = "lookupNamespaceURI")]
221    #[doc = "The `lookupNamespaceURI()` method."]
222    #[doc = ""]
223    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupNamespaceURI)"]
224    #[doc = ""]
225    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
226    pub fn lookup_namespace_uri(
227        this: &Node,
228        prefix: Option<&str>,
229    ) -> Option<::alloc::string::String>;
230    #[wasm_bindgen(method, js_class = "Node", js_name = "lookupPrefix")]
231    #[doc = "The `lookupPrefix()` method."]
232    #[doc = ""]
233    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupPrefix)"]
234    #[doc = ""]
235    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
236    pub fn lookup_prefix(this: &Node, namespace: Option<&str>) -> Option<::alloc::string::String>;
237    #[wasm_bindgen(method, js_class = "Node")]
238    #[doc = "The `normalize()` method."]
239    #[doc = ""]
240    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize)"]
241    #[doc = ""]
242    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
243    pub fn normalize(this: &Node);
244    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "removeChild")]
245    #[doc = "The `removeChild()` method."]
246    #[doc = ""]
247    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild)"]
248    #[doc = ""]
249    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
250    pub fn remove_child(this: &Node, child: &Node) -> Result<Node, JsValue>;
251    #[wasm_bindgen(catch, method, js_class = "Node", js_name = "replaceChild")]
252    #[doc = "The `replaceChild()` method."]
253    #[doc = ""]
254    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild)"]
255    #[doc = ""]
256    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
257    pub fn replace_child(this: &Node, node: &Node, child: &Node) -> Result<Node, JsValue>;
258}
259impl Node {
260    #[doc = "The `Node.ELEMENT_NODE` const."]
261    #[doc = ""]
262    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
263    pub const ELEMENT_NODE: u16 = 1u64 as u16;
264    #[doc = "The `Node.ATTRIBUTE_NODE` const."]
265    #[doc = ""]
266    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
267    pub const ATTRIBUTE_NODE: u16 = 2u64 as u16;
268    #[doc = "The `Node.TEXT_NODE` const."]
269    #[doc = ""]
270    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
271    pub const TEXT_NODE: u16 = 3u64 as u16;
272    #[doc = "The `Node.CDATA_SECTION_NODE` const."]
273    #[doc = ""]
274    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
275    pub const CDATA_SECTION_NODE: u16 = 4u64 as u16;
276    #[doc = "The `Node.ENTITY_REFERENCE_NODE` const."]
277    #[doc = ""]
278    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
279    pub const ENTITY_REFERENCE_NODE: u16 = 5u64 as u16;
280    #[doc = "The `Node.ENTITY_NODE` const."]
281    #[doc = ""]
282    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
283    pub const ENTITY_NODE: u16 = 6u64 as u16;
284    #[doc = "The `Node.PROCESSING_INSTRUCTION_NODE` const."]
285    #[doc = ""]
286    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
287    pub const PROCESSING_INSTRUCTION_NODE: u16 = 7u64 as u16;
288    #[doc = "The `Node.COMMENT_NODE` const."]
289    #[doc = ""]
290    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
291    pub const COMMENT_NODE: u16 = 8u64 as u16;
292    #[doc = "The `Node.DOCUMENT_NODE` const."]
293    #[doc = ""]
294    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
295    pub const DOCUMENT_NODE: u16 = 9u64 as u16;
296    #[doc = "The `Node.DOCUMENT_TYPE_NODE` const."]
297    #[doc = ""]
298    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
299    pub const DOCUMENT_TYPE_NODE: u16 = 10u64 as u16;
300    #[doc = "The `Node.DOCUMENT_FRAGMENT_NODE` const."]
301    #[doc = ""]
302    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
303    pub const DOCUMENT_FRAGMENT_NODE: u16 = 11u64 as u16;
304    #[doc = "The `Node.NOTATION_NODE` const."]
305    #[doc = ""]
306    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
307    pub const NOTATION_NODE: u16 = 12u64 as u16;
308    #[doc = "The `Node.DOCUMENT_POSITION_DISCONNECTED` const."]
309    #[doc = ""]
310    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
311    pub const DOCUMENT_POSITION_DISCONNECTED: u16 = 1u64 as u16;
312    #[doc = "The `Node.DOCUMENT_POSITION_PRECEDING` const."]
313    #[doc = ""]
314    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
315    pub const DOCUMENT_POSITION_PRECEDING: u16 = 2u64 as u16;
316    #[doc = "The `Node.DOCUMENT_POSITION_FOLLOWING` const."]
317    #[doc = ""]
318    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
319    pub const DOCUMENT_POSITION_FOLLOWING: u16 = 4u64 as u16;
320    #[doc = "The `Node.DOCUMENT_POSITION_CONTAINS` const."]
321    #[doc = ""]
322    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
323    pub const DOCUMENT_POSITION_CONTAINS: u16 = 8u64 as u16;
324    #[doc = "The `Node.DOCUMENT_POSITION_CONTAINED_BY` const."]
325    #[doc = ""]
326    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
327    pub const DOCUMENT_POSITION_CONTAINED_BY: u16 = 16u64 as u16;
328    #[doc = "The `Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` const."]
329    #[doc = ""]
330    #[doc = "*This API requires the following crate features to be activated: `Node`*"]
331    pub const DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: u16 = 32u64 as u16;
332}