A complex selector is a sequence of one or more compound selectors, separated by combinators.
More...
#include "donner/css/selectors/ComplexSelector.h"
|
| struct | Entry |
| | A single entry in a complex selector, which is a compound selector and a combinator. More...
|
|
|
std::vector< Entry > | entries |
| | The entries in the complex selector.
|
|
|
std::ostream & | operator<< (std::ostream &os, const ComplexSelector &obj) |
| | Ostream output operator for ComplexSelector, outputs debug strings e.g. "ComplexSelector(CompoundSelector(TypeSelector(name)))".
|
A complex selector is a sequence of one or more compound selectors, separated by combinators.
For example, div > #foo is a complex selector, with two compound selectors separated by a Combinator::Child.
◆ donner::css::ComplexSelector::Entry
| struct donner::css::ComplexSelector::Entry |
A single entry in a complex selector, which is a compound selector and a combinator.
| Class Members |
|
Combinator |
combinator |
The combinator before this compound selector. For regular selector lists, the first entry is set to Combinator::Descendant but it has no effect. For relative selector lists, the first entry is the leading combinator, for example "> div". |
|
CompoundSelector |
compoundSelector |
The compound selector. |
◆ isValid()
| bool donner::css::ComplexSelector::isValid |
( |
| ) |
const |
◆ matches()
Match a selector against an element, following the rules in the spec: https://www.w3.org/TR/selectors-4/#match-against-element.
- Template Parameters
-
| T | A type that fulfills the ElementLike concept, to enable traversing the tree to match the selector. |
- Parameters
-
| targetElement | Element to match against. |
| options | Options to control matching. |
- Returns
- true if the element matches the selector, within a SelectorMatchResult which also contains the specificity.
◆ matchesRelativeToAnchor()
template<ElementLike T>
| bool donner::css::ComplexSelector::matchesRelativeToAnchor |
( |
const T & | anchor, |
|
|
const SelectorMatchOptions< T > & | options ) const |
|
inline |
Match this relative selector forward from its anchor, including sibling relationships.
- Parameters
-
| anchor | Reference element for the leading combinator. |
| options | Scope and shared traversal budget for the match. |
- Returns
- True if a complete selector chain matches from the anchor.
The documentation for this struct was generated from the following file: