Type Alias HtmlNode

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

§

impl ViewHtmlNode for SsrNode

§

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

Create a new HTML element.
§

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

Create a new HTML element with a XML namespace.
§

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

Create a new HTML text node.
§

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

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

fn create_marker_node() -> SsrNode

Create a new HTML marker (comment) node.
§

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

Set an HTML attribute.
§

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

Set a boolean HTML attribute.
§

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

Set a JS property on an element.
§

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

Set an event handler on an element.
§

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

Set the inner HTML value of an element.
§

fn as_web_sys(&self) -> &Node

Return the raw web-sys node.
§

fn from_web_sys(_node: Node) -> SsrNode

Wrap a raw web-sys node.
§

impl ViewNode for SsrNode

§

fn append_child(&mut self, child: SsrNode)

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).
§

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

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

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.