pub struct VTag {
pub node_ref: NodeRef,
pub attributes: Attributes,
pub key: Option<Key>,
/* private fields */
}
Expand description
A type for a virtual Element representation.
Fields§
§node_ref: NodeRef
A node reference used for DOM access in Component lifecycle methods
attributes: Attributes
List of attributes.
key: Option<Key>
Implementations§
Source§impl VTag
impl VTag
Sourcepub fn new(tag: impl Into<AttrValue>) -> Self
pub fn new(tag: impl Into<AttrValue>) -> Self
Creates a new VTag instance with tag
name (cannot be changed later in DOM).
Sourcepub fn add_children(&mut self, children: impl IntoIterator<Item = VNode>)
pub fn add_children(&mut self, children: impl IntoIterator<Item = VNode>)
Add multiple VNode children.
Sourcepub fn children(&self) -> Option<&VNode>
pub fn children(&self) -> Option<&VNode>
Returns a reference to the children of this VTag, if the node can have children
Sourcepub fn children_mut(&mut self) -> Option<&mut VNode>
pub fn children_mut(&mut self) -> Option<&mut VNode>
Returns a mutable reference to the children of this VTag, if the node can have children
Sourcepub fn into_children(self) -> Option<VNode>
pub fn into_children(self) -> Option<VNode>
Returns the children of this VTag, if the node can have children
Sourcepub fn set_value(&mut self, value: impl IntoPropValue<Option<AttrValue>>)
pub fn set_value(&mut self, value: impl IntoPropValue<Option<AttrValue>>)
Sets value
for an
InputElement or
TextArea
Sourcepub fn checked(&self) -> Option<bool>
pub fn checked(&self) -> Option<bool>
Returns checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
Sourcepub fn set_checked(&mut self, value: bool)
pub fn set_checked(&mut self, value: bool)
Sets checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
Sourcepub fn preserve_checked(&mut self)
pub fn preserve_checked(&mut self)
Keeps the current value of the checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
Sourcepub fn add_attribute(&mut self, key: &'static str, value: impl Into<AttrValue>)
pub fn add_attribute(&mut self, key: &'static str, value: impl Into<AttrValue>)
Adds a key-value pair to attributes
Not every attribute works when it set as an attribute. We use workarounds for:
value
and checked
.
Sourcepub fn add_property(&mut self, key: &'static str, value: impl Into<JsValue>)
pub fn add_property(&mut self, key: &'static str, value: impl Into<JsValue>)
Set the given key as property on the element
js_sys::Reflect
is used for setting properties.
Sourcepub fn set_attributes(&mut self, attrs: impl Into<Attributes>)
pub fn set_attributes(&mut self, attrs: impl Into<Attributes>)
Sets attributes to a virtual node.
Not every attribute works when it set as an attribute. We use workarounds for:
value
and checked
.
Sourcepub fn add_listener(&mut self, listener: Rc<dyn Listener>) -> bool
pub fn add_listener(&mut self, listener: Rc<dyn Listener>) -> bool
Trait Implementations§
Source§impl ImplicitClone for VTag
impl ImplicitClone for VTag
§fn implicit_clone(&self) -> Self
fn implicit_clone(&self) -> Self
Auto Trait Implementations§
impl Freeze for VTag
impl !RefUnwindSafe for VTag
impl !Send for VTag
impl !Sync for VTag
impl Unpin for VTag
impl !UnwindSafe for VTag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.