1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibWeb: Parse CSS selectors according to the spec

The spec does not directly tell us how to parse selectors, so there are
likely some bugs here, but I've used the spec language where possible.
This is very much based on the previous selector parsing code.

Any parse error inside a selector makes the entire SelectorList
invalid, so nothing is returned.
This commit is contained in:
Sam Atkins 2021-07-23 16:13:07 +01:00 committed by Andreas Kling
parent 8d1762ac62
commit 8d0ff98eff
4 changed files with 475 additions and 374 deletions

View file

@ -88,6 +88,17 @@ public:
return m_value.string_view();
}
HashType hash_type() const
{
VERIFY(m_type == Type::Hash);
return m_hash_type;
}
StringView hash_value() const
{
VERIFY(m_type == Type::Hash);
return m_value.string_view();
}
bool is(NumberType number_type) const { return is(Token::Type::Number) && m_number_type == number_type; }
int integer() const