Trait moxie_dom::prelude::RawDom [−][src]
pub trait RawDom {
type Nodes: IntoIterator;
type MutationRecord;
type Observer: Stream + Unpin;
Show 16 methods
fn write_xml<W>(&self, writer: &mut Writer<W>)
where
W: Write;
fn get_attribute(&self, name: &str) -> Option<String>;
fn set_attribute(&self, name: &str, value: &str);
fn remove_attribute(&self, name: &str);
fn next_sibling(&self) -> Option<Self>;
fn first_child(&self) -> Option<Self>;
fn append_child(&self, child: &Self);
fn replace_child(&self, new_child: &Self, existing: &Self);
fn remove_child(&self, to_remove: &Self) -> Option<Self>;
fn get_inner_text(&self) -> String;
fn dispatch<E>(&self, event: E)
where
E: Event;
fn query_selector(&self, selectors: &str) -> Option<Self>;
fn query_selector_all(&self, selectors: &str) -> Self::Nodes;
fn observe_mutations(&self) -> Self::Observer;
fn outer_html(&self) -> String { ... }
fn pretty_outer_html(&self, indent: usize) -> String { ... }
}
Expand description
A value which implements a subset of the web’s document object model.
Associated Types
type Nodes: IntoIterator
type Nodes: IntoIterator
The type returned by query_selector_all
.
type MutationRecord
type MutationRecord
The type returned in batches by Dom::Observer
.
Required methods
Write this value as XML via the provided writer. Consider using Dom::outer_html or Dom::pretty_outer_html unless you need the performance.
fn get_attribute(&self, name: &str) -> Option<String>
fn get_attribute(&self, name: &str) -> Option<String>
Get an attribute from this DOM node.
fn set_attribute(&self, name: &str, value: &str)
fn set_attribute(&self, name: &str, value: &str)
Set an attribute on this DOM node.
fn remove_attribute(&self, name: &str)
fn remove_attribute(&self, name: &str)
Ensure the provided attribute has been removed from this DOM node.
fn next_sibling(&self) -> Option<Self>
fn next_sibling(&self) -> Option<Self>
Returns the next child of this node’s parent after this node itself.
fn first_child(&self) -> Option<Self>
fn first_child(&self) -> Option<Self>
Returns the first child of this node.
fn append_child(&self, child: &Self)
fn append_child(&self, child: &Self)
Adds a new child to the end of this node’s children.
fn replace_child(&self, new_child: &Self, existing: &Self)
fn replace_child(&self, new_child: &Self, existing: &Self)
Replaces the provided child of this node with a new one.
fn remove_child(&self, to_remove: &Self) -> Option<Self>
fn remove_child(&self, to_remove: &Self) -> Option<Self>
Removes the provided child from this node.
fn get_inner_text(&self) -> String
fn get_inner_text(&self) -> String
Represents the “rendered” text content of a node and its descendants. It approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.
Synchronously invokes the affected EventListeners in the appropriate
order. The normal event processing rules (including the capturing
and optional bubbling phase) also apply to events dispatched
manually with dispatchEvent()
.
fn query_selector(&self, selectors: &str) -> Option<Self>
fn query_selector(&self, selectors: &str) -> Option<Self>
Returns the first descendant of self
which matches the specified
selectors.
fn query_selector_all(&self, selectors: &str) -> Self::Nodes
fn query_selector_all(&self, selectors: &str) -> Self::Nodes
Returns a static (not live) Vec of descendents of self
which match the
specified selectors.
fn observe_mutations(&self) -> Self::Observer
fn observe_mutations(&self) -> Self::Observer
Return a stream of mutations related to the subtree under this node.
Provided methods
fn outer_html(&self) -> String
fn outer_html(&self) -> String
Returns a string of serialized XML without newlines or indentation.
fn pretty_outer_html(&self, indent: usize) -> String
fn pretty_outer_html(&self, indent: usize) -> String
Returns a string of “prettified” serialized XML with the provided indentation.