pub struct AncestorInfo {
pub tag: String,
pub classes: Vec<String>,
pub id: Option<String>,
pub child_index: i32,
pub sibling_count: i32,
pub siblings: Option<Siblings>,
pub has_element_children: bool,
pub text: Option<String>,
pub declarations: Vec<(String, String)>,
}Expand description
One element of a live tree as the cascade sees it: what selectors match
on, and what the element itself declares. The runtime builds these from
an entity’s components to re-resolve it, and to walk the ancestors of
the element a selector query or computed_style asks about.
Fields§
§tag: StringMarkup tag (root, tile, …). Empty for a plain layout
container that carries no LumenTag; such an ancestor then
matches only tagless compound selectors, which is correct.
classes: Vec<String>Class list assigned in markup via class="...".
id: Option<String>Stable id="...", if any.
child_index: i321-based position among element siblings. Defaults to 1 when the
caller can’t cheaply supply it - :first-child / :nth-child
on ancestors then match conservatively.
sibling_count: i32Total sibling count including self. Defaults to 1.
siblings: Option<Siblings>Every element sibling, self included, for + / ~. None makes
those steps fail rather than guess.
has_element_children: boolWhether the element has element children, for :empty.
text: Option<String>The element’s own text, for :empty.
declarations: Vec<(String, String)>What the element declares about itself, (property, value) in the
order they apply: its markup’s styling attributes, then what a
script set with set_style. These outrank every rule.
Implementations§
Source§impl AncestorInfo
impl AncestorInfo
Sourcepub fn new(
tag: impl Into<String>,
classes: Vec<String>,
id: Option<String>,
) -> Self
pub fn new( tag: impl Into<String>, classes: Vec<String>, id: Option<String>, ) -> Self
Construct from tag / classes / id with sibling position defaulted
to 1 of 1, element children assumed and no declarations of its
own. The with_* builders fill in the rest when the caller has it.
Sourcepub fn with_position(self, position: SiblingPosition) -> Self
pub fn with_position(self, position: SiblingPosition) -> Self
Builder: set the sibling position, for :nth-child /
:first-child ancestor matching.
Sourcepub fn with_siblings(self, siblings: Option<Siblings>) -> Self
pub fn with_siblings(self, siblings: Option<Siblings>) -> Self
Builder: set the sibling list, for + / ~.
Sourcepub fn with_content(
self,
has_element_children: bool,
text: Option<String>,
) -> Self
pub fn with_content( self, has_element_children: bool, text: Option<String>, ) -> Self
Builder: say whether the element has element children and what text
it holds, for :empty.
Sourcepub fn with_declarations(self, declarations: Vec<(String, String)>) -> Self
pub fn with_declarations(self, declarations: Vec<(String, String)>) -> Self
Builder: set what the element declares about itself.
Trait Implementations§
Source§impl Clone for AncestorInfo
impl Clone for AncestorInfo
Source§fn clone(&self) -> AncestorInfo
fn clone(&self) -> AncestorInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more