pub struct SsrNode(_);
Expand description
Rendering backend for Server Side Rendering, aka. SSR.
This API requires the following crate features to be activated: ssr
Implementations
sourceimpl SsrNode
impl SsrNode
pub fn unwrap_element(&self) -> &RefCell<Element>
pub fn unwrap_text(&self) -> &RefCell<Text>
sourcepub fn raw_text_node(html: &str) -> SsrNode
pub fn raw_text_node(html: &str) -> SsrNode
Create a new raw text node.
Do not pass unsanitized user input to this function. When the node is rendered, no escaping will be performed which might lead to a XSS (Cross Site Scripting) attack.
Trait Implementations
sourceimpl GenericNode for SsrNode
impl GenericNode for SsrNode
type EventType = Event
type EventType = Event
Although SsrNode
is intended to be used on the server-side instead of in the browser,
the event type is still web_sys::Event
because it must support the same API as
DomNode
. Since event handlers will never be called on the server side
anyways, it’s okay to do this.
sourceconst USE_HYDRATION_CONTEXT: bool = true
const USE_HYDRATION_CONTEXT: bool = true
Whether this rendering backend needs the hydration registry.
sourcefn marker_with_text(text: &str) -> SsrNode
fn marker_with_text(text: &str) -> SsrNode
Create a marker (dummy) node with text content. For empty marker, prefer
GenericNode::marker
instead. Read more
sourcefn set_attribute(&self, name: &str, value: &str)
fn set_attribute(&self, name: &str, value: &str)
Sets an attribute on a node.
sourcefn remove_attribute(&self, name: &str)
fn remove_attribute(&self, name: &str)
Removes an attribute on a node.
sourcefn set_class_name(&self, value: &str)
fn set_class_name(&self, value: &str)
fn add_class(&self, class: &str)
fn remove_class(&self, class: &str)
sourcefn set_property(&self, _name: &str, _value: &JsValue)
fn set_property(&self, _name: &str, _value: &JsValue)
Sets a property on a node.
sourcefn remove_property(&self, _name: &str)
fn remove_property(&self, _name: &str)
Removes a property on a node.
sourcefn append_child(&self, child: &SsrNode)
fn append_child(&self, child: &SsrNode)
Appends a child to the node’s children.
sourcefn first_child(&self) -> Option<SsrNode>
fn first_child(&self) -> Option<SsrNode>
Get the first child of the node.
sourcefn insert_child_before(
&self,
new_node: &SsrNode,
reference_node: Option<&SsrNode>
)
fn insert_child_before(
&self,
new_node: &SsrNode,
reference_node: Option<&SsrNode>
)
Insert a new child node to this node’s children. If reference_node
is Some
, the child
will be inserted before the reference node. Else if None
, the child will be inserted
at the end. Read more
sourcefn remove_child(&self, child: &SsrNode)
fn remove_child(&self, child: &SsrNode)
Remove a child node from this node’s children.
sourcefn replace_child(&self, old: &SsrNode, new: &SsrNode)
fn replace_child(&self, old: &SsrNode, new: &SsrNode)
Replace a child node from this node’s children with a new child node.
sourcefn insert_sibling_before(&self, child: &SsrNode)
fn insert_sibling_before(&self, child: &SsrNode)
Insert a new node before this node.
sourcefn parent_node(&self) -> Option<SsrNode>
fn parent_node(&self) -> Option<SsrNode>
Returns the parent node, or None
if detached.
sourcefn next_sibling(&self) -> Option<SsrNode>
fn next_sibling(&self) -> Option<SsrNode>
Returns the next sibling, or None
if this node is the last sibling.
sourcefn remove_self(&self)
fn remove_self(&self)
Remove this node from the tree.
sourcefn event(
&self,
_name: &str,
_handler: Box<dyn Fn(<SsrNode as GenericNode>::EventType) + 'static, Global>
)
fn event(
&self,
_name: &str,
_handler: Box<dyn Fn(<SsrNode as GenericNode>::EventType) + 'static, Global>
)
Add a [EventHandler
] to the event name
.
sourcefn update_inner_text(&self, text: &str)
fn update_inner_text(&self, text: &str)
Update inner text of the node. If the node has elements, all the elements are replaced with a new text node. Read more
sourcefn dangerously_set_inner_html(&self, html: &str)
fn dangerously_set_inner_html(&self, html: &str)
Updates the inner html of the node.
The html will not be parsed in non-browser environments. This means that accessing methods
such as first_child
will return None
. Read more
sourcefn clone_node(&self) -> SsrNode
fn clone_node(&self) -> SsrNode
Create a deep clone of the node.
const CLIENT_SIDE_HYDRATION: bool = false
sourcefn marker() -> Self
fn marker() -> Self
Create a marker (dummy) node. For DomNode
, this is implemented by creating an empty
comment node. This is used, for example, in Keyed
and
Indexed
for scenarios where you want to push a new item to the
end of the list. If the list is empty, a dummy node is needed to store the position of
the component. Read more
sourceimpl Html for SsrNode
impl Html for SsrNode
sourceconst IS_BROWSER: bool = false
const IS_BROWSER: bool = false
A boolean indicating whether this node is rendered in a browser context. Read more
impl Eq for SsrNode
Auto Trait Implementations
impl !RefUnwindSafe for SsrNode
impl !Send for SsrNode
impl !Sync for SsrNode
impl Unpin for SsrNode
impl !UnwindSafe for SsrNode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more