summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Selector.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-03-17 16:13:13 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-18 11:34:02 +0100
commit993653317c14f3c6bbf02b70b710658a90e1ab27 (patch)
tree581e4cb83b92ea437e13167c9efacdf2d6912978 /Userland/Libraries/LibWeb/CSS/Selector.cpp
parent47eb4b2db7496c1309092e94c2c445c5edac7885 (diff)
downloadserenity-993653317c14f3c6bbf02b70b710658a90e1ab27.zip
LibWeb: Implement the :where() selector
This is identical to :is() except for specificity, so we can use the same code paths. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Selector.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Selector.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Selector.cpp b/Userland/Libraries/LibWeb/CSS/Selector.cpp
index 85dc1a3b07..24e7ed97c8 100644
--- a/Userland/Libraries/LibWeb/CSS/Selector.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Selector.cpp
@@ -159,6 +159,7 @@ String Selector::SimpleSelector::serialize() const
case Selector::SimpleSelector::PseudoClass::Type::NthLastChild:
case Selector::SimpleSelector::PseudoClass::Type::Not:
case Selector::SimpleSelector::PseudoClass::Type::Is:
+ case Selector::SimpleSelector::PseudoClass::Type::Where:
// Otherwise, append ":" (U+003A), followed by the name of the pseudo-class, followed by "(" (U+0028),
// followed by the value of the pseudo-class argument(s) determined as per below, followed by ")" (U+0029), to s.
s.append(':');
@@ -169,9 +170,10 @@ String Selector::SimpleSelector::serialize() const
// The result of serializing the value using the rules to serialize an <an+b> value.
s.append(pseudo_class.nth_child_pattern.serialize());
} else if (pseudo_class.type == Selector::SimpleSelector::PseudoClass::Type::Not
- || pseudo_class.type == Selector::SimpleSelector::PseudoClass::Type::Is) {
+ || pseudo_class.type == Selector::SimpleSelector::PseudoClass::Type::Is
+ || pseudo_class.type == Selector::SimpleSelector::PseudoClass::Type::Where) {
// The result of serializing the value using the rules for serializing a group of selectors.
- // NOTE: `:is()` isn't in the spec for this yet, but it should be!
+ // NOTE: `:is()` and `:where()` aren't in the spec for this yet, but it should be!
s.append(serialize_a_group_of_selectors(pseudo_class.argument_selector_list));
}
s.append(')');