mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibWeb: Don't emit a simple selector if nothing was consumed
This commit is contained in:
parent
493cbb7956
commit
6676f2c259
1 changed files with 7 additions and 0 deletions
|
@ -268,6 +268,8 @@ public:
|
||||||
|
|
||||||
Optional<Selector::SimpleSelector> parse_simple_selector()
|
Optional<Selector::SimpleSelector> parse_simple_selector()
|
||||||
{
|
{
|
||||||
|
auto index_at_start = index;
|
||||||
|
|
||||||
if (consume_whitespace_or_comments())
|
if (consume_whitespace_or_comments())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@ -397,6 +399,11 @@ public:
|
||||||
simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Empty;
|
simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index == index_at_start) {
|
||||||
|
// We consumed nothing.
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
return simple_selector;
|
return simple_selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue