#[repr(C)]pub struct CssPath {
pub selectors: CssPathSelectorVec,
}Expand description
Represents a full CSS path (i.e. the “div#id.class” selector belonging to a CSS “content group” (the following key-value block)).
ⓘ
"#div > .my_class:focus" ==
[
CssPathSelector::Type(NodeTypeTag::Div),
CssPathSelector::PseudoSelector(CssPathPseudoSelector::LimitChildren),
CssPathSelector::Class("my_class"),
CssPathSelector::PseudoSelector(CssPathPseudoSelector::Focus),
]Fields§
§selectors: CssPathSelectorVecImplementations§
Source§impl CssPath
impl CssPath
pub fn new(selectors: Vec<CssPathSelector>) -> Self
Sourcepub fn push_front_scope(&mut self, start: usize, end: usize)
pub fn push_front_scope(&mut self, start: usize, end: usize)
Prepend a Root scope selector (push_front) confining this rule to the owner
node start (whose subtree spans the inclusive flat ids [start, end]).
Two cases (#47 leak fix + descendant-selector support):
- A bare
*rule (theparse_inlinewrapper for awith_css/set_cssbare-declaration string) is scoped node-only ([start, start]): inline-style semantics — it applies to the OWNER only and must not leak to descendants or siblings.[Root([s,s]), Global]matchessonly. - A rule with a real selector (
.menu-item,div, a descendant chain — fromadd_component_css/ a component stylesheet) is scoped to the whole subtree ([start, end]), so its selectors match within the owner’s subtree (e.g. a menu container’s.menu-itemchildren).[Root([s,e]), Class(x)]matches any node in[s,e]that also matches.x.
Trait Implementations§
impl Eq for CssPath
Source§impl Ord for CssPath
impl Ord for CssPath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for CssPath
impl PartialOrd for CssPath
impl StructuralPartialEq for CssPath
Auto Trait Implementations§
impl Freeze for CssPath
impl RefUnwindSafe for CssPath
impl Send for CssPath
impl Sync for CssPath
impl Unpin for CssPath
impl UnsafeUnpin for CssPath
impl UnwindSafe for CssPath
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