SelectorList Class
A selector list (https://drafts.csswg.org/selectors-4/#selector-list). Parsed selectors are immutable.
public sealed class SelectorListProperties
| Name | Description |
|---|---|
| MaxSpecificity | The maximum specificity of the selectors of the list (used by :is(), :not(), :has() and :nth-child(of S)). |
| Selectors | Gets the complex selectors of the list, in source order. |
MaxSpecificity
Selector.csThe maximum specificity of the selectors of the list (used by :is(), :not(), :has() and :nth-child(of S)).
public Specificity MaxSpecificity { get; }Property value
Selectors
Selector.csGets the complex selectors of the list, in source order.
public ImmutableArray<ComplexSelector> Selectors { get; }Property value
Methods
| Name | Description |
|---|---|
| Matches(Element) | Returns whether the element matches the selector, as Element.Matches does (https://dom.spec.whatwg.org/#dom-element-matches). |
| Parse(string) | Parses a selector list, as querySelector does (https://dom.spec.whatwg.org/#scope-match-a-selectors-string): namespace prefixes other than * and the empty prefix are invalid. |
| ToString() | Serializes the selector list (https://drafts.csswg.org/cssom/#serialize-a-group-of-selectors). |
| TryParse(string, SelectorList?) | Parses a selector list, as SelectorList.Parse does, without throwing when the selector is invalid. |
Matches(Element)
Selector.csReturns whether the element matches the selector, as Element.Matches does (https://dom.spec.whatwg.org/#dom-element-matches).
Parse(string)
Selector.csParses a selector list, as querySelector does (https://dom.spec.whatwg.org/#scope-match-a-selectors-string): namespace prefixes other than * and the empty prefix are invalid.
public static SelectorList Parse(string selectors)ToString()
Selector.csTryParse(string, SelectorList?)
Selector.csParses a selector list, as SelectorList.Parse does, without throwing when the selector is invalid.
public static bool TryParse(string selectors, out SelectorList? result)