Selector which match the element's class attribute, for example .foo matches an element with class foo.
More...
#include "donner/css/selectors/ClassSelector.h"
|
| | ClassSelector (const RcString &name) |
| | Create a ClassSelector with the given name.
|
|
| ~ClassSelector () noexcept=default |
| | Destructor.
|
|
| ClassSelector (ClassSelector &&)=default |
| | Move constructor.
|
|
ClassSelector & | operator= (ClassSelector &&)=default |
| | Move assignment operator.
|
|
| ClassSelector (const ClassSelector &)=default |
| | Copy constructor.
|
|
ClassSelector & | operator= (const ClassSelector &)=default |
| | Copy assignment operator.
|
|
bool | isValid () const |
| | Returns true if this is a valid selector.
|
| template<ElementLike T> |
| bool | matches (const T &element) const |
| | Returns true if the provided element matches this selector, based on if the element's class attribute's whitespace-separated list of classes exactly contains this selector's name.
|
|
|
RcString | name |
| | The class to match, without the leading ..
|
|
|
std::ostream & | operator<< (std::ostream &os, const ClassSelector &obj) |
| | Ostream output operator.
|
Selector which match the element's class attribute, for example .foo matches an element with class foo.
See https://www.w3.org/TR/selectors-4/#class-html for the full definition.
◆ ClassSelector()
| donner::css::ClassSelector::ClassSelector |
( |
const RcString & | name | ) |
|
|
inlineexplicit |
Create a ClassSelector with the given name.
- Parameters
-
| name | The class to match, without the leading .. |
◆ matches()
template<ElementLike T>
| bool donner::css::ClassSelector::matches |
( |
const T & | element | ) |
const |
|
inline |
Returns true if the provided element matches this selector, based on if the element's class attribute's whitespace-separated list of classes exactly contains this selector's name.
Comparison is case-sensitive.
- Parameters
-
| element | The element to check. |
The documentation for this struct was generated from the following file: