summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Selector.cpp
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-11-05 15:18:14 +0000
committerAndreas Kling <kling@serenityos.org>2022-11-07 14:10:41 +0100
commitf984c70b204e07ca93052dbf71caa469be15db31 (patch)
tree3a67d46724391cfb2fccf1dd0fd9e962f9559e29 /Userland/Libraries/LibWeb/CSS/Selector.cpp
parent1fbad9caaf07401e3206cd8c355721952bdbfbce (diff)
downloadserenity-f984c70b204e07ca93052dbf71caa469be15db31.zip
LibWeb: Implement :lang pseudo class serialization
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Selector.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Selector.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Selector.cpp b/Userland/Libraries/LibWeb/CSS/Selector.cpp
index 02e3656a30..dff7ce49a9 100644
--- a/Userland/Libraries/LibWeb/CSS/Selector.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Selector.cpp
@@ -238,6 +238,7 @@ String Selector::SimpleSelector::serialize() const
case Selector::SimpleSelector::PseudoClass::Type::Not:
case Selector::SimpleSelector::PseudoClass::Type::Is:
case Selector::SimpleSelector::PseudoClass::Type::Where:
+ case Selector::SimpleSelector::PseudoClass::Type::Lang:
// 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(':');
@@ -255,10 +256,14 @@ String Selector::SimpleSelector::serialize() const
// The result of serializing the value using the rules for serializing a group of selectors.
// 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));
+ } else if (pseudo_class.type == Selector::SimpleSelector::PseudoClass::Type::Lang) {
+ // The serialization of a comma-separated list of each argument’s serialization as a string, preserving relative order.
+ s.join(", "sv, pseudo_class.languages);
}
s.append(')');
break;
default:
+ dbgln("FIXME: Unknown pseudo class type for serialization: {}", to_underlying(pseudo_class.type));
VERIFY_NOT_REACHED();
}
break;