mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:45:08 +00:00
LibWeb: Implement the :focus-within selector
This matches if it has focus, or any nodes inside it do.
This commit is contained in:
parent
4827092554
commit
d60b3be29a
4 changed files with 12 additions and 0 deletions
|
@ -137,6 +137,10 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
return matches_hover_pseudo_class(element);
|
||||
case CSS::Selector::SimpleSelector::PseudoClass::Type::Focus:
|
||||
return element.is_focused();
|
||||
case CSS::Selector::SimpleSelector::PseudoClass::Type::FocusWithin: {
|
||||
auto* focused_element = element.document().focused_element();
|
||||
return focused_element && element.is_inclusive_ancestor_of(*focused_element);
|
||||
}
|
||||
case CSS::Selector::SimpleSelector::PseudoClass::Type::FirstChild:
|
||||
return !element.previous_element_sibling();
|
||||
case CSS::Selector::SimpleSelector::PseudoClass::Type::LastChild:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue