Enum yew::virtual_dom::VNode
source · pub enum VNode {
VTag(Box<VTag>),
VText(VText),
VComp(VComp),
VList(VList),
VPortal(VPortal),
VRef(Node),
VSuspense(VSuspense),
VRaw(VRaw),
}
Expand description
Bind virtual element to a DOM reference.
Variants§
VTag(Box<VTag>)
A bind between VTag
and Element
.
VText(VText)
A bind between VText
and TextNode
.
VComp(VComp)
A bind between VComp
and Element
.
VList(VList)
A holder for a list of other nodes.
VPortal(VPortal)
A portal to another part of the document
VRef(Node)
A holder for any Node
(necessary for replacing node).
VSuspense(VSuspense)
A suspendible document fragment.
VRaw(VRaw)
A raw HTML string, represented by AttrValue
.
Also see: VNode::from_html_unchecked
Implementations§
source§impl VNode
impl VNode
pub fn key(&self) -> Option<&Key>
sourcepub fn from_html_unchecked(html: AttrValue) -> Self
pub fn from_html_unchecked(html: AttrValue) -> Self
Create a VNode
from a string of HTML
Behavior in browser
In the browser, this function creates an element, sets the passed HTML to its innerHTML
and inserts the contents of it into the DOM.
Behavior on server
When rendering on the server, the contents of HTML are directly injected into the HTML stream.
Warning
The contents are not sanitized or validated. You, as the developer, are responsible to ensure the HTML string passed to this method are valid and not malicious
Example
use yew::{html, AttrValue, Html};
let parsed = Html::from_html_unchecked(AttrValue::from("<div>content</div>"));
let _: Html = html! {
<div>
{parsed}
</div>
};
Trait Implementations§
source§impl<A: Into<VNode>> FromIterator<A> for VNode
impl<A: Into<VNode>> FromIterator<A> for VNode
source§fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self
source§impl IntoPropValue<ChildrenRenderer<VNode>> for VNode
impl IntoPropValue<ChildrenRenderer<VNode>> for VNode
source§fn into_prop_value(self) -> Children
fn into_prop_value(self) -> Children
self
to a value of a Properties
struct.source§impl IntoPropValue<Option<ChildrenRenderer<VNode>>> for VNode
impl IntoPropValue<Option<ChildrenRenderer<VNode>>> for VNode
source§fn into_prop_value(self) -> Option<Children>
fn into_prop_value(self) -> Option<Children>
self
to a value of a Properties
struct.