1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:25:07 +00:00

LibHTML: Support the :first-child and :last-child pseudo classes

This commit is contained in:
Andreas Kling 2019-12-16 19:34:52 +01:00
parent 870df4a8c6
commit c1474e594e
6 changed files with 63 additions and 0 deletions

View file

@ -27,6 +27,14 @@ bool matches(const Selector::SimpleSelector& component, const Element& element)
if (!matches_hover_pseudo_class(element))
return false;
break;
case Selector::SimpleSelector::PseudoClass::FirstChild:
if (element.previous_element_sibling())
return false;
break;
case Selector::SimpleSelector::PseudoClass::LastChild:
if (element.next_element_sibling())
return false;
break;
}
switch (component.attribute_match_type) {