pub struct Element(/* private fields */);
Expand description
A reference to a JavaScript object which implements the IElement interface.
Trait Implementations§
Source§impl From<CanvasElement> for Element
impl From<CanvasElement> for Element
Source§fn from(value: CanvasElement) -> Self
fn from(value: CanvasElement) -> Self
Converts to this type from the input type.
Source§impl From<Element> for EventTarget
impl From<Element> for EventTarget
Source§impl From<HtmlElement> for Element
impl From<HtmlElement> for Element
Source§fn from(value: HtmlElement) -> Self
fn from(value: HtmlElement) -> Self
Converts to this type from the input type.
Source§impl From<ImageElement> for Element
impl From<ImageElement> for Element
Source§fn from(value: ImageElement) -> Self
fn from(value: ImageElement) -> Self
Converts to this type from the input type.
Source§impl From<InputElement> for Element
impl From<InputElement> for Element
Source§fn from(value: InputElement) -> Self
fn from(value: InputElement) -> Self
Converts to this type from the input type.
Source§impl From<OptionElement> for Element
impl From<OptionElement> for Element
Source§fn from(value: OptionElement) -> Self
fn from(value: OptionElement) -> Self
Converts to this type from the input type.
Source§impl From<SelectElement> for Element
impl From<SelectElement> for Element
Source§fn from(value: SelectElement) -> Self
fn from(value: SelectElement) -> Self
Converts to this type from the input type.
Source§impl From<SlotElement> for Element
impl From<SlotElement> for Element
Source§fn from(value: SlotElement) -> Self
fn from(value: SlotElement) -> Self
Converts to this type from the input type.
Source§impl From<TemplateElement> for Element
impl From<TemplateElement> for Element
Source§fn from(value: TemplateElement) -> Self
fn from(value: TemplateElement) -> Self
Converts to this type from the input type.
Source§impl From<TextAreaElement> for Element
impl From<TextAreaElement> for Element
Source§fn from(value: TextAreaElement) -> Self
fn from(value: TextAreaElement) -> Self
Converts to this type from the input type.
Source§impl IElement for Element
impl IElement for Element
Source§fn namespace_uri(&self) -> Option<String>
fn namespace_uri(&self) -> Option<String>
The Element.namespaceURI read-only property returns the namespace URI
of the element, or null if the element is not in a namespace. Read more
Source§fn class_list(&self) -> TokenList
fn class_list(&self) -> TokenList
Source§fn has_attribute(&self, name: &str) -> bool
fn has_attribute(&self, name: &str) -> bool
The Element.hasAttribute() method returns a Boolean value indicating whether
the specified element has the specified attribute or not. Read more
Source§fn get_attribute(&self, name: &str) -> Option<String>
fn get_attribute(&self, name: &str) -> Option<String>
Element.getAttribute() returns the value of a specified attribute on the element.
If the given attribute does not exist, the value returned will either be
null or “” (the empty string); Read more
Source§fn set_attribute(
&self,
name: &str,
value: &str,
) -> Result<(), InvalidCharacterError>
fn set_attribute( &self, name: &str, value: &str, ) -> Result<(), InvalidCharacterError>
Sets the value of an attribute on the specified element. If the attribute already
exists, the value is updated; otherwise a new attribute is added with the
specified name and value. Read more
Source§fn scroll_top(&self) -> f64
fn scroll_top(&self) -> f64
Gets the the number of pixels that an element’s content is scrolled vertically. Read more
Source§fn set_scroll_top(&self, value: f64)
fn set_scroll_top(&self, value: f64)
Sets the the number of pixels that an element’s content is scrolled vertically. Read more
Source§fn scroll_left(&self) -> f64
fn scroll_left(&self) -> f64
Gets the the number of pixels that an element’s content is scrolled to the left. Read more
Source§fn set_scroll_left(&self, value: f64)
fn set_scroll_left(&self, value: f64)
Sets the the number of pixels that an element’s content is scrolled to the left. Read more
Source§fn get_attribute_names(&self) -> Vec<String>
fn get_attribute_names(&self) -> Vec<String>
Element.getAttributeNames() returns the attribute names of the element
as an Array of strings. If the element has no attributes it returns an empty array. Read more
Source§fn remove_attribute(&self, name: &str)
fn remove_attribute(&self, name: &str)
Element.removeAttribute removes an attribute from the specified element. Read more
Source§fn has_attributes(&self) -> bool
fn has_attributes(&self) -> bool
The Element.hasAttributes() method returns Boolean value, indicating if
the current element has any attributes or not. Read more
Source§fn closest(&self, selectors: &str) -> Result<Option<Element>, SyntaxError>
fn closest(&self, selectors: &str) -> Result<Option<Element>, SyntaxError>
Returns the closest ancestor of the element (or the element itself) which matches the selectors
given in parameter. If there isn’t such an ancestor, it returns
None
. Read moreSource§fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>
fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>
Designates a specific element as the capture target of future pointer events. Read more
Source§fn release_pointer_capture(
&self,
pointer_id: i32,
) -> Result<(), InvalidPointerId>
fn release_pointer_capture( &self, pointer_id: i32, ) -> Result<(), InvalidPointerId>
Releases pointer capture that was previously set for a specific pointer Read more
Source§fn has_pointer_capture(&self, pointer_id: i32) -> bool
fn has_pointer_capture(&self, pointer_id: i32) -> bool
Returns a boolean indicating if the element has captured the specified pointer Read more
Source§fn insert_adjacent_html(
&self,
position: InsertPosition,
html: &str,
) -> Result<(), InsertAdjacentError>
fn insert_adjacent_html( &self, position: InsertPosition, html: &str, ) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment into specified position. Read more
Source§fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>
fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment before element. Read more
Source§fn prepend_html(&self, html: &str) -> Result<(), InsertAdjacentError>
fn prepend_html(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment as the first children of the element. Read more
Source§fn append_html(&self, html: &str) -> Result<(), InsertAdjacentError>
fn append_html(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment as the last children of the element. Read more
Source§fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>
fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment after element. Read more
Source§fn slot(&self) -> String
fn slot(&self) -> String
The slot property of the Element interface returns the name of the shadow DOM
slot the element is inserted in. Read more
Source§fn attach_shadow(
&self,
mode: ShadowRootMode,
) -> Result<ShadowRoot, AttachShadowError>
fn attach_shadow( &self, mode: ShadowRootMode, ) -> Result<ShadowRoot, AttachShadowError>
Attach a shadow DOM tree to the specified element and returns a reference to its
ShadowRoot
.
It returns a shadow root if successfully attached or None
if the element cannot be attached. Read moreSource§fn shadow_root(&self) -> Option<ShadowRoot>
fn shadow_root(&self) -> Option<ShadowRoot>
Returns the shadow root of the current element or
None
. Read moreSource§impl IEventTarget for Element
impl IEventTarget for Element
Source§fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandlewhere
T: ConcreteEvent,
F: FnMut(T) + 'static,
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandlewhere
T: ConcreteEvent,
F: FnMut(T) + 'static,
Adds given event handler to the list of event listeners for
the specified
EventTarget
on which it’s called. Read moreSource§impl INode for Element
impl INode for Element
Source§fn append_child<T: INode>(&self, child: &T)
fn append_child<T: INode>(&self, child: &T)
Adds a node to the end of the list of children of a specified parent node. Read more
Source§fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
Removes a child node from the DOM. Read more
Source§fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
Returns a duplicate of the node on which this method was called. Read more
Source§fn contains<T: INode>(&self, node: &T) -> bool
fn contains<T: INode>(&self, node: &T) -> bool
Checks whenever a given node is a descendant of this one or not. Read more
Source§fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U,
) -> Result<Node, InsertNodeError>
fn insert_before<T: INode, U: INode>( &self, new_node: &T, reference_node: &U, ) -> Result<Node, InsertNodeError>
Inserts the specified node before the reference node as a child of the current node. Read more
Source§fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U,
) -> Result<Node, InsertNodeError>
fn replace_child<T: INode, U: INode>( &self, new_child: &T, old_child: &U, ) -> Result<Node, InsertNodeError>
Replaces one hild node of the specified node with another. Read more
Source§fn parent_node(&self) -> Option<Node>
fn parent_node(&self) -> Option<Node>
Returns the parent of this node in the DOM tree. Read more
Source§fn first_child(&self) -> Option<Node>
fn first_child(&self) -> Option<Node>
Returns the node’s first child in the tree, or
None
if the node is childless. Read moreSource§fn last_child(&self) -> Option<Node>
fn last_child(&self) -> Option<Node>
Returns the node’s last child in the tree, or
None
if the node is childless. Read moreSource§fn next_sibling(&self) -> Option<Node>
fn next_sibling(&self) -> Option<Node>
Returns the node’s next sibling in the tree, or
None
if there isn’t such a node. Read moreSource§fn owner_document(&self) -> Option<Document>
fn owner_document(&self) -> Option<Document>
Returns the
Document
that this node belongs to. Read moreSource§fn parent_element(&self) -> Option<Element>
fn parent_element(&self) -> Option<Element>
Returns an
Element
that is the parent of this node. Returns null
if the node
has no parent or the parent is not an Element
. Read moreSource§fn previous_sibling(&self) -> Option<Node>
fn previous_sibling(&self) -> Option<Node>
Returns the node’s previous sibling in the tree, or
None
if there isn’t such a node. Read moreSource§fn text_content(&self) -> Option<String>
fn text_content(&self) -> Option<String>
A property which represents the text content of a node and its descendants. Read more
Source§fn set_text_content(&self, text: &str)
fn set_text_content(&self, text: &str)
Sets the text content of this node; calling thil removes all
of node’s children and replaces them with a single text node
with the given value. Read more
Source§fn child_nodes(&self) -> NodeList
fn child_nodes(&self) -> NodeList
Returns a live collection of child nodes of this node. Read more
Source§fn has_child_nodes(&self) -> bool
fn has_child_nodes(&self) -> bool
Returns whether this node has children nodes. Read more
Source§fn is_default_namespace(&self, namespace: &str) -> bool
fn is_default_namespace(&self, namespace: &str) -> bool
Determines whether the given namespace is the default namespace of this node. Read more
Source§fn is_equal_node<T: INode>(&self, node: &T) -> bool
fn is_equal_node<T: INode>(&self, node: &T) -> bool
Tests whether this node is equal to another node. Two nodes are equal if
they have the same type, defining characteristics, matching attributes,
and so on. Read more
Source§fn is_same_node<T: INode>(&self, node: &T) -> bool
fn is_same_node<T: INode>(&self, node: &T) -> bool
Test whether two
Node
references are the same. Read moreSource§fn lookup_prefix(&self, namespace: &str) -> Option<String>
fn lookup_prefix(&self, namespace: &str) -> Option<String>
Returns the prefix for the given namespace URI, if present. Read more
Source§impl InstanceOf for Element
impl InstanceOf for Element
Source§impl ReferenceType for Element
impl ReferenceType for Element
Source§unsafe fn from_reference_unchecked(reference: Reference) -> Self
unsafe fn from_reference_unchecked(reference: Reference) -> Self
Converts a given reference into a concrete reference-like wrapper.
Doesn’t do any type checking; highly unsafe to use!
Source§impl TryFrom<Element> for CanvasElement
impl TryFrom<Element> for CanvasElement
Source§impl TryFrom<Element> for HtmlElement
impl TryFrom<Element> for HtmlElement
Source§impl TryFrom<Element> for ImageElement
impl TryFrom<Element> for ImageElement
Source§impl TryFrom<Element> for InputElement
impl TryFrom<Element> for InputElement
Source§impl TryFrom<Element> for OptionElement
impl TryFrom<Element> for OptionElement
Source§impl TryFrom<Element> for SelectElement
impl TryFrom<Element> for SelectElement
Source§impl TryFrom<Element> for SlotElement
impl TryFrom<Element> for SlotElement
Source§impl TryFrom<Element> for TemplateElement
impl TryFrom<Element> for TemplateElement
Source§impl TryFrom<Element> for TextAreaElement
impl TryFrom<Element> for TextAreaElement
Source§impl TryFrom<EventTarget> for Element
impl TryFrom<EventTarget> for Element
impl Eq for Element
impl JsSerialize for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IChildNode for Twhere
T: IElement,
impl<T> IChildNode for Twhere
T: IElement,
Source§impl<T> IParentNode for Twhere
T: IElement,
impl<T> IParentNode for Twhere
T: IElement,
Source§fn query_selector(&self, selector: &str) -> Result<Option<Element>, SyntaxError>
fn query_selector(&self, selector: &str) -> Result<Option<Element>, SyntaxError>
Returns the first element that is a descendant of the element on which it is
invoked that matches the specified group of selectors. Read more