mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb/CSS: Keep invalid parts of <forgiving-selector-list>
s around
Selectors like `:is(.valid, &!?!?!invalid)` need to keep the invalid part around, even though it will never match, for a couple of reasons: - Serialization needs to include them - For nesting, we care if a `&` appeared anywhere in the selector, even in an invalid part. So this patch introduces an `Invalid` simple selector type, which simply holds its original ComponentValues. We search through these looking for `&`, and we dump them out directly when asked to serialize.
This commit is contained in:
parent
1849eca503
commit
698dd600f2
Notes:
github-actions[bot]
2024-11-13 19:39:05 +00:00
Author: https://github.com/AtkinsSJ
Commit: 698dd600f2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2317
8 changed files with 110 additions and 3 deletions
|
@ -764,6 +764,9 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, Optio
|
|||
// :is() is handled already, by us replacing it with :is() directly, so if we
|
||||
// got here, it's :scope.
|
||||
return matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClassSelector { .type = CSS::PseudoClass::Scope }, style_sheet_for_rule, element, shadow_host, scope, selector_kind);
|
||||
case CSS::Selector::SimpleSelector::Type::Invalid:
|
||||
// Invalid selectors never match
|
||||
return false;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue