1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:17:35 +00:00

LibWeb: Add basic support for :lang() CSS selector

This doesn't have parsing support for multiple languages in the same
selector. Support for language subcodes is not great either. But it
does do the basics.
This commit is contained in:
Andreas Kling 2022-03-20 12:39:11 +01:00
parent 5d672717aa
commit bdd42c9b0e
4 changed files with 52 additions and 1 deletions

View file

@ -79,6 +79,7 @@ public:
Not,
Where,
Active,
Lang,
};
Type type { Type::None };
@ -87,6 +88,9 @@ public:
ANPlusBPattern nth_child_pattern;
SelectorList argument_selector_list {};
// Used for :lang(en-gb,dk)
Vector<FlyString> languages;
};
PseudoClass pseudo_class {};
PseudoElement pseudo_element { PseudoElement::None };
@ -219,6 +223,8 @@ constexpr StringView pseudo_class_name(Selector::SimpleSelector::PseudoClass::Ty
return "not"sv;
case Selector::SimpleSelector::PseudoClass::Type::Where:
return "where"sv;
case Selector::SimpleSelector::PseudoClass::Type::Lang:
return "lang"sv;
case Selector::SimpleSelector::PseudoClass::Type::None:
break;
}