mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibWeb: Parse :host() selector
We were already parsing non-function-syntax :host, so let's also do the :host(...) variant. Note that we don't have matching for these yet. This fixes many issues on sites generated by Wix, as they often have selector lists that include some :host() selector, and we'd reject the entire rule after failing to parse it.
This commit is contained in:
parent
ac2d9d9273
commit
64c06c345e
4 changed files with 35 additions and 0 deletions
|
@ -613,6 +613,17 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
.argument_selector_list = move(not_selector) }
|
||||
};
|
||||
}
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("host"sv)) {
|
||||
auto function_token_stream = TokenStream(pseudo_function.values());
|
||||
auto host_selector = TRY(parse_a_selector_list(function_token_stream, SelectorType::Standalone));
|
||||
|
||||
return Selector::SimpleSelector {
|
||||
.type = Selector::SimpleSelector::Type::PseudoClass,
|
||||
.value = Selector::SimpleSelector::PseudoClass {
|
||||
.type = Selector::SimpleSelector::PseudoClass::Type::Host,
|
||||
.argument_selector_list = move(host_selector) }
|
||||
};
|
||||
}
|
||||
if (pseudo_function.name().equals_ignoring_ascii_case("lang"sv)) {
|
||||
if (pseudo_function.values().is_empty()) {
|
||||
dbgln_if(CSS_PARSER_DEBUG, "Empty :lang() selector");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue