1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 14:44:57 +00:00

LibHTML: Parse descendant relations in CSS selectors

"div p" now generates a Selector with two components where the second
component is a type=TagName, value="p", relation=Descendant.

We still don't handle matching of these, but at least we parse them.
This commit is contained in:
Andreas Kling 2019-10-06 11:05:57 +02:00
parent 847072c2b1
commit 2a266db05b
3 changed files with 9 additions and 1 deletions

View file

@ -88,7 +88,7 @@ public:
{
consume_whitespace();
Selector::Component::Type type;
Selector::Component::Relation relation = Selector::Component::Relation::None;
Selector::Component::Relation relation = Selector::Component::Relation::Descendant;
if (peek() == '{')
return {};
@ -149,6 +149,10 @@ public:
break;
}
if (components.is_empty())
return;
components.first().relation = Selector::Component::Relation::None;
current_rule.selectors.append(Selector(move(components)));
};