pub struct Text(/* private fields */);Expand description
A text node. Leaf only — cannot have children.
Implements Node but NOT ContainerNode or Element.
Access text content via content() / set_content().
Implementations§
Trait Implementations§
Source§impl EventTarget for Text
impl EventTarget for Text
Source§fn on<E: Event>(
&self,
callback: impl FnMut(&E, &EventContext) + 'static,
) -> ListenerId
fn on<E: Event>( &self, callback: impl FnMut(&E, &EventContext) + 'static, ) -> ListenerId
Add a typed event listener. Returns an ID for removal. Read more
Source§fn on_with_options<E: Event>(
&self,
callback: impl FnMut(&E, &EventContext) + 'static,
options: ListenerOptions,
) -> ListenerId
fn on_with_options<E: Event>( &self, callback: impl FnMut(&E, &EventContext) + 'static, options: ListenerOptions, ) -> ListenerId
Add a listener with explicit options. Read more
Source§fn on_capture<E: Event>(
&self,
callback: impl FnMut(&E, &EventContext) + 'static,
) -> ListenerId
fn on_capture<E: Event>( &self, callback: impl FnMut(&E, &EventContext) + 'static, ) -> ListenerId
Add a capture-phase listener. Read more
Source§fn on_once<E: Event>(
&self,
callback: impl FnMut(&E, &EventContext) + 'static,
) -> ListenerId
fn on_once<E: Event>( &self, callback: impl FnMut(&E, &EventContext) + 'static, ) -> ListenerId
Add a one-shot listener that auto-removes after first call.
Source§fn off(&self, id: ListenerId)
fn off(&self, id: ListenerId)
Remove a listener by its ID.
Source§impl Node for Text
impl Node for Text
Source§fn parent(&self) -> Option<Handle>
fn parent(&self) -> Option<Handle>
Get the parent node, or
None if this is the root or detached.Source§fn next_sibling(&self) -> Option<Handle>
fn next_sibling(&self) -> Option<Handle>
Get the next sibling in the parent’s child list.
Source§fn prev_sibling(&self) -> Option<Handle>
fn prev_sibling(&self) -> Option<Handle>
Get the previous sibling in the parent’s child list.
Source§fn detach(&self)
fn detach(&self)
Detach this node from its parent. The node stays alive but is no longer in the tree.
Source§fn node_kind(&self) -> Option<NodeType>
fn node_kind(&self) -> Option<NodeType>
Get the DOM node type (Element, Text, Document, etc.).
Source§fn is_element(&self) -> bool
fn is_element(&self) -> bool
Is this an element node?
Source§fn is_document(&self) -> bool
fn is_document(&self) -> bool
Is this the document root?
Source§fn style(&self) -> StyleAccess
fn style(&self) -> StyleAccess
Per-property style access — like JavaScript’s
element.style.impl Copy for Text
Auto Trait Implementations§
impl Freeze for Text
impl !RefUnwindSafe for Text
impl Send for Text
impl !Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl !UnwindSafe for Text
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert