pub trait IElement:
INode
+ IParentNode
+ IChildNode
+ ISlotable {
Show 24 methods
// Provided methods
fn namespace_uri(&self) -> Option<String> { ... }
fn class_list(&self) -> TokenList { ... }
fn has_attribute(&self, name: &str) -> bool { ... }
fn get_attribute(&self, name: &str) -> Option<String> { ... }
fn set_attribute(
&self,
name: &str,
value: &str,
) -> Result<(), InvalidCharacterError> { ... }
fn scroll_top(&self) -> f64 { ... }
fn set_scroll_top(&self, value: f64) { ... }
fn scroll_left(&self) -> f64 { ... }
fn set_scroll_left(&self, value: f64) { ... }
fn get_attribute_names(&self) -> Vec<String> { ... }
fn remove_attribute(&self, name: &str) { ... }
fn has_attributes(&self) -> bool { ... }
fn closest(&self, selectors: &str) -> Result<Option<Element>, SyntaxError> { ... }
fn set_pointer_capture(
&self,
pointer_id: i32,
) -> Result<(), InvalidPointerId> { ... }
fn release_pointer_capture(
&self,
pointer_id: i32,
) -> Result<(), InvalidPointerId> { ... }
fn has_pointer_capture(&self, pointer_id: i32) -> bool { ... }
fn insert_adjacent_html(
&self,
position: InsertPosition,
html: &str,
) -> Result<(), InsertAdjacentError> { ... }
fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError> { ... }
fn prepend_html(&self, html: &str) -> Result<(), InsertAdjacentError> { ... }
fn append_html(&self, html: &str) -> Result<(), InsertAdjacentError> { ... }
fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError> { ... }
fn slot(&self) -> String { ... }
fn attach_shadow(
&self,
mode: ShadowRootMode,
) -> Result<ShadowRoot, AttachShadowError> { ... }
fn shadow_root(&self) -> Option<ShadowRoot> { ... }
}Expand description
The IElement interface represents an object of a Document.
This interface describes methods and properties common to all
kinds of elements.
Provided Methods§
Sourcefn 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.
Sourcefn class_list(&self) -> TokenList
fn class_list(&self) -> TokenList
The Element.classList is a read-only property which returns a live TokenList collection of the class attributes of the element.
Sourcefn 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.
Sourcefn 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);
Sourcefn 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.
Sourcefn scroll_top(&self) -> f64
fn scroll_top(&self) -> f64
Gets the the number of pixels that an element’s content is scrolled vertically.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn remove_attribute(&self, name: &str)
fn remove_attribute(&self, name: &str)
Element.removeAttribute removes an attribute from the specified element.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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
Sourcefn 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
Sourcefn 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.
Sourcefn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>
fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment before element.
Sourcefn 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.
Sourcefn 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.
Sourcefn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>
fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>
Insert nodes from HTML fragment after element.
Sourcefn 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.
Sourcefn 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.
Sourcefn shadow_root(&self) -> Option<ShadowRoot>
fn shadow_root(&self) -> Option<ShadowRoot>
Returns the shadow root of the current element or None.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.