MCPcopy Create free account
hub / github.com/csskit/csskit / matching_metadata_pseudos

Method matching_metadata_pseudos

crates/csskit_ast/src/selector/query.rs:599–615  ·  view source on GitHub ↗

Returns an iterator of metadata-based pseudo-class names that match the given metadata. This only includes pseudos that can be determined from metadata alone, excluding positional pseudos like `:first-child` or `:nth-of-type`.

(meta: &CssMetadata)

Source from the content-addressed store, hash-verified

597 /// This only includes pseudos that can be determined from metadata alone,
598 /// excluding positional pseudos like `:first-child` or `:nth-of-type`.
599 pub fn matching_metadata_pseudos(meta: &CssMetadata) -> impl Iterator<Item = &'static str> {
600 [
601 (meta.has_important(), "important"),
602 (meta.has_custom_properties(), "custom"),
603 (meta.has_computed(), "computed"),
604 (meta.has_shorthands(), "shorthand"),
605 (meta.has_longhands(), "longhand"),
606 (meta.has_unknown(), "unknown"),
607 (meta.has_at_rules(), "at-rule"),
608 (meta.has_rules(), "rule"),
609 (meta.has_functions(), "function"),
610 (meta.is_empty_container(), "empty"),
611 (meta.has_vendor_prefixes(), "prefixed"),
612 ]
613 .into_iter()
614 .filter_map(|(matches, name)| matches.then_some(name))
615 }
616}
617
618/// Functional pseudo-classes (`:not()`, `:nth-child()`, etc.).

Callers

nothing calls this directly

Calls 12

into_iterMethod · 0.80
has_importantMethod · 0.80
has_custom_propertiesMethod · 0.80
has_computedMethod · 0.80
has_shorthandsMethod · 0.80
has_longhandsMethod · 0.80
has_unknownMethod · 0.80
has_at_rulesMethod · 0.80
has_rulesMethod · 0.80
has_functionsMethod · 0.80
is_empty_containerMethod · 0.80
has_vendor_prefixesMethod · 0.80

Tested by

no test coverage detected