Struct sauron::prelude::dom::DomNode

source ·
pub struct DomNode { /* private fields */ }
Expand description

A counter part of the vdom Node This is needed, so that we can

  1. Keep track of event closure and drop them when nodes has been removed
  2. Custom removal of children nodes on a stateful component

Implementations§

source§

impl DomNode

source

pub fn is_element(&self) -> bool

returns true if this an element node

source

pub fn is_fragment(&self) -> bool

returns true if this a fragment node

source

pub fn is_text_node(&self) -> bool

returns true if this a text node

source

pub fn is_comment(&self) -> bool

returns true if this Comment node

source

pub fn is_symbol(&self) -> bool

returns true if this DomNode is a html entity symbol

source

pub fn is_stateful_component(&self) -> bool

returns true if this is a stateful component

source

pub fn as_node(&self) -> Node

exposed the underlying wrapped node as web_sys::Node

source

pub fn as_element(&self) -> Element

exposed the underlying wrapped node as web_sys::Element

source

pub fn as_symbol(&self) -> Option<&str>

return the string content of this symbol

source

pub fn outer_html(&self) -> String

return the outer html string of an element

source

pub fn append_children(&self, for_append: Vec<DomNode>)

append the DomNode child into this DomNode self

source

pub fn set_dom_attrs( &self, attrs: impl IntoIterator<Item = DomAttr> ) -> Result<(), JsValue>

set the attributes of the dom element

source

pub fn set_dom_attr(&self, attr: DomAttr) -> Result<(), JsValue>

set the attribute of the dom element

source

pub fn render_to_string(&self) -> String

render this DomNode into an html string represenation

Trait Implementations§

source§

impl Clone for DomNode

source§

fn clone(&self) -> DomNode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DomNode

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<Node> for DomNode

source§

fn from(node: Node) -> DomNode

Converts to this type from the input type.
source§

impl PartialEq for DomNode

source§

fn eq(&self, other: &DomNode) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for DomNode

§

impl !RefUnwindSafe for DomNode

§

impl !Send for DomNode

§

impl !Sync for DomNode

§

impl Unpin for DomNode

§

impl !UnwindSafe for DomNode

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.