pub struct DomNode {
pub inner: Rc<RefCell<DomNodeInner>>,
}Expand description
A node in the Document Object Model tree.
Fields§
§inner: Rc<RefCell<DomNodeInner>>Implementations§
Source§impl DomNode
impl DomNode
pub fn element(tag: &str, attributes: HashMap<String, String>) -> Self
pub fn text(content: &str) -> Self
pub fn comment(content: &str) -> Self
pub fn tag_name(&self) -> Option<String>
pub fn id(&self) -> Option<String>
pub fn class_name(&self) -> String
pub fn set_class_name(&self, val: &str)
pub fn get_attribute(&self, name: &str) -> Option<String>
pub fn set_attribute(&self, name: &str, val: &str)
pub fn remove_attribute(&self, name: &str)
pub fn has_attribute(&self, name: &str) -> bool
pub fn get_style(&self, prop: &str) -> Option<String>
pub fn set_style(&self, prop: &str, val: &str)
pub fn text_content(&self) -> String
pub fn uid(&self) -> u64
pub fn set_text_content(&self, text: &str)
pub fn inner_html(&self) -> String
pub fn set_inner_html(&self, html: &str)
pub fn outer_html(&self) -> String
pub fn parent_node(&self) -> Option<DomNode>
pub fn parent_element(&self) -> Option<DomNode>
pub fn first_child(&self) -> Option<DomNode>
pub fn last_child(&self) -> Option<DomNode>
pub fn first_element_child(&self) -> Option<DomNode>
pub fn last_element_child(&self) -> Option<DomNode>
pub fn previous_sibling(&self) -> Option<DomNode>
pub fn next_sibling(&self) -> Option<DomNode>
pub fn previous_element_sibling(&self) -> Option<DomNode>
pub fn next_element_sibling(&self) -> Option<DomNode>
pub fn child_element_count(&self) -> usize
pub fn child_nodes(&self) -> Vec<DomNode>
pub fn append_child(&self, child: DomNode) -> DomNode
pub fn prepend_child(&self, child: DomNode) -> DomNode
pub fn insert_before( &self, new_child: DomNode, reference_child: Option<&DomNode>, ) -> Result<DomNode, String>
pub fn replace_child( &self, new_child: DomNode, old_child: &DomNode, ) -> Result<DomNode, String>
pub fn remove_child(&self, child: &DomNode) -> bool
pub fn remove(&self) -> bool
pub fn replace_with(&self, new_node: DomNode) -> bool
pub fn contains(&self, other: &DomNode) -> bool
pub fn clone_node(&self, deep: bool) -> DomNode
pub fn children(&self) -> Vec<DomNode>
pub fn get_element_by_id(&self, id: &str) -> Option<DomNode>
pub fn query_selector(&self, selector: &str) -> Option<DomNode>
pub fn query_selector_all(&self, selector: &str) -> Vec<DomNode>
pub fn add_event_listener(&self, event: &str, callback: JsValue)
pub fn dispatch_event(&self, event: &str, engine: &mut JsEngine)
pub fn dispatch_event_with_args( &self, event: &str, args: Vec<JsValue>, engine: &mut JsEngine, )
pub fn dispatch_event_with_bubbling( &self, event: &str, event_obj: JsValue, engine: &mut JsEngine, )
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DomNode
impl !Send for DomNode
impl !Sync for DomNode
impl !UnwindSafe for DomNode
impl Forget for DomNode
impl Freeze for DomNode
impl Move for DomNode
impl Unpin for DomNode
impl UnsafeUnpin for DomNode
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