Struct leptos_dom::html::HtmlElement
source · pub struct HtmlElement<El: ElementDescriptor> { /* private fields */ }
Expand description
Represents an HTML element.
Implementations§
source§impl<El: ElementDescriptor + 'static> HtmlElement<El>
impl<El: ElementDescriptor + 'static> HtmlElement<El>
sourcepub fn with_view_marker(self, marker: impl Into<String>) -> Self
pub fn with_view_marker(self, marker: impl Into<String>) -> Self
Adds an optional marker indicating the view macro source.
sourcepub fn into_any(self) -> HtmlElement<AnyElement>
pub fn into_any(self) -> HtmlElement<AnyElement>
Converts this element into HtmlElement<AnyElement>
.
sourcepub fn node_ref(self, node_ref: NodeRef<El>) -> Selfwhere
Self: Clone,
pub fn node_ref(self, node_ref: NodeRef<El>) -> Selfwhere Self: Clone,
Binds the element reference to NodeRef
.
sourcepub fn on_mount(self, f: impl FnOnce(Self) + 'static) -> Self
pub fn on_mount(self, f: impl FnOnce(Self) + 'static) -> Self
Runs the callback when this element has been mounted to the DOM.
Important Note
This method will only ever run at most once. If this element is unmounted and remounted, or moved somewhere else, it will not re-run unless you call this method again.
sourcepub fn is_mounted(&self) -> bool
pub fn is_mounted(&self) -> bool
Checks to see if this element is mounted to the DOM as a child
of body
.
This method will always return None
on non-wasm CSR targets.
sourcepub fn attr(
self,
name: impl Into<Cow<'static, str>>,
attr: impl IntoAttribute
) -> Self
pub fn attr( self, name: impl Into<Cow<'static, str>>, attr: impl IntoAttribute ) -> Self
Adds an attribute to this element.
sourcepub fn class(
self,
name: impl Into<Cow<'static, str>>,
class: impl IntoClass
) -> Self
pub fn class( self, name: impl Into<Cow<'static, str>>, class: impl IntoClass ) -> Self
Adds a class to an element.
sourcepub fn classes(self, classes: impl Into<Cow<'static, str>>) -> Self
pub fn classes(self, classes: impl Into<Cow<'static, str>>) -> Self
Adds a list of classes separated by ASCII whitespace to an element.
sourcepub fn dyn_classes<I, C>(self, classes_signal: impl Fn() -> I + 'static) -> Selfwhere
I: IntoIterator<Item = C>,
C: Into<Cow<'static, str>>,
pub fn dyn_classes<I, C>(self, classes_signal: impl Fn() -> I + 'static) -> Selfwhere I: IntoIterator<Item = C>, C: Into<Cow<'static, str>>,
Sets the class on the element as the class signal changes.
sourcepub fn prop(
self,
name: impl Into<Cow<'static, str>>,
value: impl IntoProperty
) -> Self
pub fn prop( self, name: impl Into<Cow<'static, str>>, value: impl IntoProperty ) -> Self
Sets a property on an element.
sourcepub fn on<E: EventDescriptor + 'static>(
self,
event: E,
event_handler: impl FnMut(E::EventType) + 'static
) -> Self
pub fn on<E: EventDescriptor + 'static>( self, event: E, event_handler: impl FnMut(E::EventType) + 'static ) -> Self
Adds an event listener to this element.
Trait Implementations§
source§impl<El: Clone + ElementDescriptor> Clone for HtmlElement<El>
impl<El: Clone + ElementDescriptor> Clone for HtmlElement<El>
source§fn clone(&self) -> HtmlElement<El>
fn clone(&self) -> HtmlElement<El>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more