mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Treat CSS selectors containing undeclared namespaces as invalid
Selectors containing undeclared namespaces should be considered invalid, not just not matching any elements. Gains us 3 new WPT passes.
This commit is contained in:
parent
5fcf3d0b05
commit
6584ae0080
Notes:
github-actions[bot]
2025-06-24 11:52:28 +00:00
Author: https://github.com/Calme1709
Commit: 6584ae0080
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5184
Reviewed-by: https://github.com/AtkinsSJ ✅
17 changed files with 157 additions and 11 deletions
|
@ -126,12 +126,17 @@ void CSSStyleRule::set_selector_text(StringView selector_text)
|
|||
clear_caches();
|
||||
|
||||
// 1. Run the parse a group of selectors algorithm on the given value.
|
||||
Parser::ParsingParams parsing_params { realm() };
|
||||
|
||||
if (m_parent_style_sheet)
|
||||
parsing_params.declared_namespaces = m_parent_style_sheet->declared_namespaces();
|
||||
|
||||
Optional<SelectorList> parsed_selectors;
|
||||
if (parent_style_rule()) {
|
||||
// AD-HOC: If we're a nested style rule, then we need to parse the selector as relative and then adapt it with implicit &s.
|
||||
parsed_selectors = parse_selector_for_nested_style_rule(Parser::ParsingParams { realm() }, selector_text);
|
||||
parsed_selectors = parse_selector_for_nested_style_rule(parsing_params, selector_text);
|
||||
} else {
|
||||
parsed_selectors = parse_selector(Parser::ParsingParams { realm() }, selector_text);
|
||||
parsed_selectors = parse_selector(parsing_params, selector_text);
|
||||
}
|
||||
|
||||
// 2. If the algorithm returns a non-null value replace the associated group of selectors with the returned value.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue