Trait IElement

Source
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.

(JavaScript docs)

Provided Methods§

Source

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.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

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);

(Javascript docs)

Source

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.

(Javascript docs)

Source

fn scroll_top(&self) -> f64

Gets the the number of pixels that an element’s content is scrolled vertically.

(Javascript docs)

Source

fn set_scroll_top(&self, value: f64)

Sets the the number of pixels that an element’s content is scrolled vertically.

(Javascript docs)

Source

fn scroll_left(&self) -> f64

Gets the the number of pixels that an element’s content is scrolled to the left.

(Javascript docs)

Source

fn set_scroll_left(&self, value: f64)

Sets the the number of pixels that an element’s content is scrolled to the left.

(Javascript docs)

Source

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.

(Javascript docs)

Source

fn remove_attribute(&self, name: &str)

Element.removeAttribute removes an attribute from the specified element.

(Javascript docs)

Source

fn has_attributes(&self) -> bool

The Element.hasAttributes() method returns Boolean value, indicating if the current element has any attributes or not.

(Javascript docs)

Source

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.

(JavaScript docs)

Source

fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>

Designates a specific element as the capture target of future pointer events.

(JavaScript docs)

Source

fn release_pointer_capture( &self, pointer_id: i32, ) -> Result<(), InvalidPointerId>

Releases pointer capture that was previously set for a specific pointer

(JavaScript docs)

Source

fn has_pointer_capture(&self, pointer_id: i32) -> bool

Returns a boolean indicating if the element has captured the specified pointer

(JavaScript docs)

Source

fn insert_adjacent_html( &self, position: InsertPosition, html: &str, ) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment into specified position.

(JavaScript docs)

Source

fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment before element.

(JavaScript docs)

Source

fn prepend_html(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment as the first children of the element.

(JavaScript docs)

Source

fn append_html(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment as the last children of the element.

(JavaScript docs)

Source

fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment after element.

(JavaScript docs)

Source

fn slot(&self) -> String

The slot property of the Element interface returns the name of the shadow DOM slot the element is inserted in.

(JavaScript docs)

Source

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.

(JavaScript docs)

Source

fn shadow_root(&self) -> Option<ShadowRoot>

Returns the shadow root of the current element or None.

(JavaScript docs)

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.

Implementors§