mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 21:22:08 +00:00
LibWeb: Implement the :target-within
pseudo-class selector
As noted in a9620d8784
we don't currently
set the target element so this does not function, so no tests. But it
should work once we have a fleshed out Navigables implementation. :^)
This commit is contained in:
parent
3af8b491b4
commit
3d10bf3ae7
2 changed files with 9 additions and 0 deletions
|
@ -446,6 +446,12 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
}
|
||||
case CSS::PseudoClass::Target:
|
||||
return element.is_target();
|
||||
case CSS::PseudoClass::TargetWithin: {
|
||||
auto* target_element = element.document().target_element();
|
||||
if (!target_element)
|
||||
return false;
|
||||
return element.is_inclusive_ancestor_of(*target_element);
|
||||
}
|
||||
case CSS::PseudoClass::Dir: {
|
||||
// "Values other than ltr and rtl are not invalid, but do not match anything."
|
||||
// - https://www.w3.org/TR/selectors-4/#the-dir-pseudo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue