mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 05:42:06 +00:00
LibWeb: Use Selectors instead of a String for :not() selectors
Rather than parsing the selector every time we want to check it, we now parse it once at the beginning. A bonus effect of this is that we now support a selector list in :not(), instead of just a single selector, though only when using the new parser.
This commit is contained in:
parent
776b1f4548
commit
ffc81cbfad
8 changed files with 40 additions and 19 deletions
|
@ -606,7 +606,11 @@ public:
|
|||
pseudo_class.type = CSS::Selector::SimpleSelector::PseudoClass::Type::Checked;
|
||||
} else if (pseudo_name.starts_with("not", CaseSensitivity::CaseInsensitive)) {
|
||||
pseudo_class.type = CSS::Selector::SimpleSelector::PseudoClass::Type::Not;
|
||||
pseudo_class.not_selector = capture_selector_args(pseudo_name);
|
||||
auto not_selector = Web::parse_selector(m_context, capture_selector_args(pseudo_name));
|
||||
if (not_selector) {
|
||||
pseudo_class.not_selector.clear();
|
||||
pseudo_class.not_selector.append(not_selector.release_nonnull());
|
||||
}
|
||||
} else {
|
||||
dbgln("Unknown pseudo class: '{}'", pseudo_name);
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue