pub struct HtmlMainElement(/* private fields */);Expand description
<main> — the dominant content of the document.
Trait Implementations§
Source§impl Clone for HtmlMainElement
impl Clone for HtmlMainElement
Source§fn clone(&self) -> HtmlMainElement
fn clone(&self) -> HtmlMainElement
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 HtmlMainElement
impl ContainerNode for HtmlMainElement
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 HtmlMainElement
impl Debug for HtmlMainElement
Source§impl Element for HtmlMainElement
impl Element for HtmlMainElement
Source§const IS_FOCUSABLE: bool = false
const IS_FOCUSABLE: bool = false
Whether this element is focusable by default.
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 HtmlMainElement
impl EventTarget for HtmlMainElement
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 HtmlMainElement
impl HasHandle for HtmlMainElement
Source§impl HtmlElement for HtmlMainElement
impl HtmlElement for HtmlMainElement
The
hidden attribute. Elements with hidden should not be rendered.fn set_title(&self, title: impl Into<String>)
fn set_lang(&self, lang: impl Into<String>)
fn set_dir(&self, dir: impl Into<String>)
Source§fn tab_index(&self) -> i32
fn tab_index(&self) -> i32
The
tabindex attribute. Controls focus order.
Returns the element’s default if not explicitly set.fn set_tab_index(&self, index: i32)
fn set_draggable(&self, draggable: bool)
Source§fn spellcheck(&self) -> bool
fn spellcheck(&self) -> bool
The
spellcheck attribute.fn set_spellcheck(&self, spellcheck: bool)
Source§fn collect_presentation_styles(&self)
fn collect_presentation_styles(&self)
Map presentation attributes to a
PropertyDeclarationBlock. Read moreSource§impl Node for HtmlMainElement
impl Node for HtmlMainElement
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 HtmlMainElement
Auto Trait Implementations§
impl Freeze for HtmlMainElement
impl !RefUnwindSafe for HtmlMainElement
impl Send for HtmlMainElement
impl !Sync for HtmlMainElement
impl Unpin for HtmlMainElement
impl UnsafeUnpin for HtmlMainElement
impl !UnwindSafe for HtmlMainElement
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