mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
LibWeb: Parse CSS selectors with no space before a combinator
Previously selectors like `.foo>.bar` did not parse, because there is no whitespace between `.foo` and `>`. Now we correctly parse these. :^)
This commit is contained in:
parent
bd83edf148
commit
640a980080
Notes:
sideshowbarker
2024-07-18 04:07:36 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/640a980080f Pull-request: https://github.com/SerenityOS/serenity/pull/9998
1 changed files with 10 additions and 0 deletions
|
@ -637,6 +637,16 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
|
|||
}
|
||||
}
|
||||
|
||||
// Whitespace is not required between the compound-selector and a combinator.
|
||||
// So, if we see a combinator, return that this compound-selector is done, instead of a syntax error.
|
||||
if (first_value.is(Token::Type::Delim)) {
|
||||
auto delim = first_value.token().delim();
|
||||
if ((delim == ">"sv) || (delim == "+"sv) || (delim == "~"sv) || (delim == "|"sv)) {
|
||||
tokens.reconsume_current_input_token();
|
||||
return SelectorParsingResult::Done;
|
||||
}
|
||||
}
|
||||
|
||||
dbgln_if(CSS_PARSER_DEBUG, "!!! Invalid simple selector!");
|
||||
return SelectorParsingResult::SyntaxError;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue