pub struct HtmlHeadingElement(/* private fields */);Expand description
A heading element (<h1> through <h6>).
Chrome equivalent: HTMLHeadingElement.
One type for all 6 levels. The actual level is determined by the
runtime tag name, not the const TAG_NAME.
Implementations§
Source§impl HtmlHeadingElement
impl HtmlHeadingElement
Sourcepub fn heading_level(&self) -> u8
pub fn heading_level(&self) -> u8
Get the heading level from the tag name.
Returns 1-6 based on the actual runtime tag.
Falls back to the stored level data.
Trait Implementations§
Source§impl Clone for HtmlHeadingElement
impl Clone for HtmlHeadingElement
Source§fn clone(&self) -> HtmlHeadingElement
fn clone(&self) -> HtmlHeadingElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ContainerNode for HtmlHeadingElement
impl ContainerNode for HtmlHeadingElement
Source§fn append(&self, child: impl HasHandle)
fn append(&self, child: impl HasHandle)
Append
child as the last child of this node. Read moreSource§fn child(self, child: impl HasHandle) -> Self
fn child(self, child: impl HasHandle) -> Self
Append a child and return self for chaining (GPUI-style). Read more
Source§fn add_children<I, C>(self, items: I) -> Selfwhere
I: IntoIterator<Item = C>,
C: HasHandle,
fn add_children<I, C>(self, items: I) -> Selfwhere
I: IntoIterator<Item = C>,
C: HasHandle,
Append multiple children at once.
Source§fn insert_before(&self, child: impl HasHandle)
fn insert_before(&self, child: impl HasHandle)
Insert
child before this node in the parent’s child list.Source§fn first_child(&self) -> Option<Handle>
fn first_child(&self) -> Option<Handle>
Get the first child, or
None if empty.Source§fn last_child(&self) -> Option<Handle>
fn last_child(&self) -> Option<Handle>
Get the last child, or
None if empty.Source§impl Debug for HtmlHeadingElement
impl Debug for HtmlHeadingElement
Source§impl Element for HtmlHeadingElement
impl Element for HtmlHeadingElement
Source§const IS_FOCUSABLE: bool = false
const IS_FOCUSABLE: bool = false
Whether this element is focusable by default.
Source§type Data = HeadingData
type Data = HeadingData
Element-specific data type (e.g.,
ButtonData). Use () if none.Source§fn from_handle(handle: Handle) -> Self
fn from_handle(handle: Handle) -> Self
Wrap a raw Handle into this element’s typed handle. Read more
Source§fn tag_name(&self) -> &'static str
fn tag_name(&self) -> &'static str
Get the tag name (runtime — reads from
ElementData). Read moreSource§fn class_name(&self) -> String
fn class_name(&self) -> String
Get the
class attribute.Source§fn set_class_name(&self, class: impl Into<String>)
fn set_class_name(&self, class: impl Into<String>)
Set the
class attribute.Source§fn class_add(&self, name: &str)
fn class_add(&self, name: &str)
Add a CSS class. No-op if already present.
Chrome:
element.classList.add("name").Source§fn class_remove(&self, name: &str)
fn class_remove(&self, name: &str)
Remove a CSS class. No-op if absent.
Chrome:
element.classList.remove("name").Source§fn class_toggle(&self, name: &str) -> bool
fn class_toggle(&self, name: &str) -> bool
Toggle a CSS class. Returns true if now present.
Chrome:
element.classList.toggle("name").Source§fn class_contains(&self, name: &str) -> bool
fn class_contains(&self, name: &str) -> bool
Check if an element has a CSS class.
Chrome:
element.classList.contains("name").Source§impl EventTarget for HtmlHeadingElement
impl EventTarget for HtmlHeadingElement
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 HasHandle for HtmlHeadingElement
impl HasHandle for HtmlHeadingElement
Source§impl Node for HtmlHeadingElement
impl Node for HtmlHeadingElement
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 HtmlHeadingElement
Auto Trait Implementations§
impl Freeze for HtmlHeadingElement
impl !RefUnwindSafe for HtmlHeadingElement
impl Send for HtmlHeadingElement
impl !Sync for HtmlHeadingElement
impl Unpin for HtmlHeadingElement
impl UnsafeUnpin for HtmlHeadingElement
impl !UnwindSafe for HtmlHeadingElement
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