1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:58:12 +00:00

LibWeb: Implement :lang pseudo class serialization

This commit is contained in:
Luke Wilde 2022-11-05 15:18:14 +00:00 committed by Andreas Kling
parent 1fbad9caaf
commit f984c70b20

View file

@ -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 arguments 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;