Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Libraries/LibWeb/CSS/Selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,14 @@ u32 Selector::specificity() const
++tag_names;
break;
case SimpleSelector::Type::PseudoElement:
// count the number of type selectors and pseudo-elements in the selector (= C)
// FIXME: This needs special handling for view transition pseudos:
// https://drafts.csswg.org/css-view-transitions-1/#named-view-transition-pseudo
// https://drafts.csswg.org/css-view-transitions-1/#named-view-transition-pseudo
// The specificity of a named view transition pseudo-element selector with a <custom-ident> argument is equivalent
// to a type selector. The specificity of a named view transition pseudo-element selector with a '*' argument is zero.
// NB: We just break before adding to the type (tag name) specificity in case this is a named view transition pseudo that uses '*'
if (first_is_one_of(simple_selector.pseudo_element().type(), CSS::PseudoElement::ViewTransitionGroup, CSS::PseudoElement::ViewTransitionImagePair, CSS::PseudoElement::ViewTransitionOld, CSS::PseudoElement::ViewTransitionNew) && simple_selector.pseudo_element().pt_name_selector().is_universal)
break;

// otherwise just count the number of type selectors and pseudo-elements in the selector (= C)
++tag_names;
break;
case SimpleSelector::Type::Universal:
Expand Down
Loading