mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 11:06:10 +00:00
LibWeb: Implement the :has()
pseudo-class
See https://drafts.csswg.org/selectors-4/#relational.
This commit is contained in:
parent
be1075e673
commit
f63a945ba0
Notes:
sideshowbarker
2024-07-17 02:22:23 +09:00
Author: https://github.com/dzfrias
Commit: f63a945ba0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/613
Reviewed-by: https://github.com/AtkinsSJ ✅
21 changed files with 203 additions and 17 deletions
|
@ -516,10 +516,14 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
.argument_selector_list = { move(selector) } }
|
||||
};
|
||||
}
|
||||
case PseudoClassMetadata::ParameterType::ForgivingRelativeSelectorList:
|
||||
case PseudoClassMetadata::ParameterType::ForgivingSelectorList: {
|
||||
auto function_token_stream = TokenStream(pseudo_function.values());
|
||||
auto selector_type = metadata.parameter_type == PseudoClassMetadata::ParameterType::ForgivingSelectorList
|
||||
? SelectorType::Standalone
|
||||
: SelectorType::Relative;
|
||||
// NOTE: Because it's forgiving, even complete garbage will parse OK as an empty selector-list.
|
||||
auto argument_selector_list = MUST(parse_a_selector_list(function_token_stream, SelectorType::Standalone, SelectorParsingMode::Forgiving));
|
||||
auto argument_selector_list = MUST(parse_a_selector_list(function_token_stream, selector_type, SelectorParsingMode::Forgiving));
|
||||
|
||||
return Selector::SimpleSelector {
|
||||
.type = Selector::SimpleSelector::Type::PseudoClass,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue