pub struct DomNode {
pub id: DomId,
pub meta: WidgetMeta,
pub state: NodeState,
pub parent: Option<DomId>,
pub children: Vec<DomId>,
pub computed_style: Style,
pub inline_style: Option<Style>,
}Expand description
A node in the DOM tree
Fields§
§id: DomIdUnique node identifier
meta: WidgetMetaWidget metadata
state: NodeStateCurrent state
parent: Option<DomId>Parent node ID (None for root)
children: Vec<DomId>Child node IDs
computed_style: StyleComputed style (after cascade)
inline_style: Option<Style>Inline style (highest priority)
Implementations§
Source§impl DomNode
impl DomNode
Sourcepub fn new(id: DomId, meta: WidgetMeta) -> Self
pub fn new(id: DomId, meta: WidgetMeta) -> Self
Create a new DOM node
Sourcepub fn widget_type(&self) -> &str
pub fn widget_type(&self) -> &str
Get widget type
Sourcepub fn element_id(&self) -> Option<&str>
pub fn element_id(&self) -> Option<&str>
Get element ID
Sourcepub fn matches_pseudo(&self, pseudo: &PseudoClass) -> bool
pub fn matches_pseudo(&self, pseudo: &PseudoClass) -> bool
Check if this node matches a pseudo-class
Sourcepub fn set_inline_style(&mut self, style: Style)
pub fn set_inline_style(&mut self, style: Style)
Set inline style
Sourcepub fn remove_child(&mut self, child_id: DomId)
pub fn remove_child(&mut self, child_id: DomId)
Remove a child
Sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Check if has children
Sourcepub fn child_count(&self) -> usize
pub fn child_count(&self) -> usize
Get child count
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomNode
impl RefUnwindSafe for DomNode
impl Send for DomNode
impl Sync for DomNode
impl Unpin for DomNode
impl UnsafeUnpin for DomNode
impl UnwindSafe for DomNode
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