|
|
Donner
C++20 SVG rendering library
|
Parse a CSS selector, or list of selectors, and returns a Selector that can be matched against in the stylesheet. More...
#include "donner/css/parser/SelectorParser.h"
Static Public Member Functions | |
| static ParseResult< Selector > | ParseComponents (std::span< const ComponentValue > components) |
| Parse CSS selector from a list of ComponentValues, see https://www.w3.org/TR/selectors-4/#parse-selector. | |
| static ParseResult< Selector > | Parse (std::string_view str) |
| Parse CSS selector from a string. | |
| static Selector | ParseForgivingSelectorList (std::span< const ComponentValue > components) |
| Parse a "forgiving selector list", which is a list of selectors separated by commas, with invalid selectors removed. | |
| static Selector | ParseForgivingRelativeSelectorList (std::span< const ComponentValue > components) |
| Parse a "forgiving relative selector list", which is a list of selectors separated by commas, with invalid selectors removed. | |
Parse a CSS selector, or list of selectors, and returns a Selector that can be matched against in the stylesheet.
Parses either from a string, or from the CSS intermediate representation, a list of ComponentValues.
For example, valid selectors may be "div", "div > p", "div > p:first-child", "div > p:first-child:hover", etc. See https://www.w3.org/TR/selectors-4/#parse-selector for more details.
|
static |
Parse CSS selector from a string.
| str | The string to parse. |
|
static |
Parse CSS selector from a list of ComponentValues, see https://www.w3.org/TR/selectors-4/#parse-selector.
| components | The list of ComponentValues to parse. |
|
static |
Parse a "forgiving relative selector list", which is a list of selectors separated by commas, with invalid selectors removed.
As relative selectors, these may start with a combinator, such as > div.
These can be matched with Selector::matches with SelectorMatchOptions::relativeToElement set.
|
static |
Parse a "forgiving selector list", which is a list of selectors separated by commas, with invalid selectors removed.
This is different from the standard CSS behavior, where if a single selector within a list of invalid, the entire selector list is ignored.
For example, "div, p:invalid" will return a single selector, "div".
| components | The list of ComponentValues to parse. |