mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibWeb: Don't emit a simple selector if nothing was consumed
This commit is contained in:
parent
493cbb7956
commit
6676f2c259
Notes:
sideshowbarker
2024-07-19 06:57:12 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6676f2c259e
1 changed files with 7 additions and 0 deletions
|
@ -268,6 +268,8 @@ public:
|
|||
|
||||
Optional<Selector::SimpleSelector> parse_simple_selector()
|
||||
{
|
||||
auto index_at_start = index;
|
||||
|
||||
if (consume_whitespace_or_comments())
|
||||
return {};
|
||||
|
||||
|
@ -397,6 +399,11 @@ public:
|
|||
simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Empty;
|
||||
}
|
||||
|
||||
if (index == index_at_start) {
|
||||
// We consumed nothing.
|
||||
return {};
|
||||
}
|
||||
|
||||
return simple_selector;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue