mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 17:02:12 +00:00
LibWeb: Move pseudo-element-from-string code into Selector
This commit is contained in:
parent
adc08d0646
commit
1c18bb13a2
3 changed files with 21 additions and 11 deletions
|
@ -261,4 +261,20 @@ String serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selec
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
Optional<Selector::PseudoElement> pseudo_element_from_string(StringView name)
|
||||
{
|
||||
if (name.equals_ignoring_case("after")) {
|
||||
return Selector::PseudoElement::After;
|
||||
} else if (name.equals_ignoring_case("before")) {
|
||||
return Selector::PseudoElement::Before;
|
||||
} else if (name.equals_ignoring_case("first-letter")) {
|
||||
return Selector::PseudoElement::FirstLetter;
|
||||
} else if (name.equals_ignoring_case("first-line")) {
|
||||
return Selector::PseudoElement::FirstLine;
|
||||
} else if (name.equals_ignoring_case("marker")) {
|
||||
return Selector::PseudoElement::Marker;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue