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

LibHTML: Support the :empty pseudo class

This commit is contained in:
Andreas Kling 2019-12-16 19:45:50 +01:00
parent a32cae4c3b
commit 085cafd80a
5 changed files with 35 additions and 0 deletions

View file

@ -1,6 +1,7 @@
#include <LibHTML/CSS/SelectorEngine.h>
#include <LibHTML/DOM/Document.h>
#include <LibHTML/DOM/Element.h>
#include <LibHTML/DOM/Text.h>
namespace SelectorEngine {
@ -35,6 +36,10 @@ bool matches(const Selector::SimpleSelector& component, const Element& element)
if (element.next_element_sibling())
return false;
break;
case Selector::SimpleSelector::PseudoClass::Empty:
if (element.first_child_of_type<Element>() || element.first_child_of_type<Text>())
return false;
break;
}
switch (component.attribute_match_type) {