Type Alias HtmlNode

Source
pub type HtmlNode = SsrNode;
Expand description

A type alias for the rendering backend.

Aliased Type§

enum HtmlNode {
    Element {
        tag: Cow<'static, str>,
        attributes: Vec<(Cow<'static, str>, Cow<'static, str>)>,
        bool_attributes: Vec<(Cow<'static, str>, bool)>,
        children: Vec<SsrNode>,
        inner_html: Option<Box<Cow<'static, str>>>,
        hk_key: Option<HydrationKey>,
    },
    TextDynamic {
        text: Cow<'static, str>,
    },
    TextStatic {
        text: Cow<'static, str>,
    },
    Marker,
    Dynamic {
        view: Arc<Mutex<View>>,
    },
    SuspenseMarker {
        key: u32,
    },
}

Variants§

§

Element

Fields

§tag: Cow<'static, str>
§attributes: Vec<(Cow<'static, str>, Cow<'static, str>)>
§bool_attributes: Vec<(Cow<'static, str>, bool)>
§children: Vec<SsrNode>
§inner_html: Option<Box<Cow<'static, str>>>
§

TextDynamic

Fields

§text: Cow<'static, str>
§

TextStatic

Fields

§text: Cow<'static, str>
§

Marker

§

Dynamic

SSR by default does not update to any dynamic changes in the view. This special node allows dynamically changing the view tree before it is rendered.

This is used for updating the view with suspense content once it is resolved.

Fields

§view: Arc<Mutex<View>>
§

SuspenseMarker

Fields

§key: u32

Trait Implementations

Source§

impl ViewHtmlNode for SsrNode

Source§

fn create_element(tag: Cow<'static, str>) -> Self

Create a new HTML element.
Source§

fn create_element_ns(_namespace: &str, tag: Cow<'static, str>) -> Self

Create a new HTML element with a XML namespace.
Source§

fn create_text_node(text: Cow<'static, str>) -> Self

Create a new HTML text node.
Source§

fn create_dynamic_text_node(text: Cow<'static, str>) -> Self

Create a new HTML text node whose value will be changed dynamically.
Source§

fn create_marker_node() -> Self

Create a new HTML marker (comment) node.
Source§

fn set_attribute(&mut self, name: Cow<'static, str>, value: StringAttribute)

Set an HTML attribute.
Source§

fn set_bool_attribute(&mut self, name: Cow<'static, str>, value: BoolAttribute)

Set a boolean HTML attribute.
Source§

fn set_property(&mut self, _name: Cow<'static, str>, _value: MaybeDyn<JsValue>)

Set a JS property on an element.
Source§

fn set_event_handler( &mut self, _name: Cow<'static, str>, _handler: impl FnMut(Event) + 'static, )

Set an event handler on an element.
Source§

fn set_inner_html(&mut self, inner_html: Cow<'static, str>)

Set the inner HTML value of an element.
Source§

fn as_web_sys(&self) -> &Node

Return the raw web-sys node.
Source§

fn from_web_sys(_node: Node) -> Self

Wrap a raw web-sys node.
Source§

impl ViewNode for SsrNode

Source§

fn append_child(&mut self, child: Self)

Appends a child to the node. Panics if the node is not an element or other node that can have children (e.g. text node).
Source§

fn create_dynamic_view<U: Into<View<Self>> + 'static>( f: impl FnMut() -> U + 'static, ) -> View<Self>

Create a dynamic view from a function that returns a view. Read more
Source§

fn append_view(&mut self, view: View<Self>)

Append a view to this node. Since a view is just a list of nodes, this essentially appends every node in the view to this node.