mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 15:19:16 +00:00
LibWeb/CSS: Make :heading() pseudo-class take integers not AN+B
Corresponds to 8eb3787e34
This commit is contained in:
parent
9ffc15ba3f
commit
d461e96f40
Notes:
github-actions[bot]
2025-08-28 10:41:31 +00:00
Author: https://github.com/AtkinsSJ
Commit: d461e96f40
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6009
Reviewed-by: https://github.com/gmta ✅
10 changed files with 79 additions and 161 deletions
|
@ -1037,7 +1037,7 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
// The :heading pseudo-class must match all h1, h2, h3, h4, h5, and h6 elements.
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics-other.html#selector-heading-functional
|
||||
// The :heading(An+B#) pseudo-class must match all h1, h2, h3, h4, h5, and h6 elements that have a heading level among An+B. [CSSSYNTAX] [CSSVALUES]
|
||||
// The :heading(integer#) pseudo-class must match all h1, h2, h3, h4, h5, and h6 elements that have a heading level of integer. [CSSSYNTAX] [CSSVALUES]
|
||||
|
||||
// NB: We combine the "is this an h* element?" and "what is it's level?" checks together here.
|
||||
if (!element.is_html_element())
|
||||
|
@ -1061,15 +1061,10 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
if (!heading_level.has_value())
|
||||
return false;
|
||||
|
||||
if (pseudo_class.an_plus_b_patterns.is_empty())
|
||||
if (pseudo_class.levels.is_empty())
|
||||
return true;
|
||||
|
||||
for (auto const& an_plus_b_pattern : pseudo_class.an_plus_b_patterns) {
|
||||
if (an_plus_b_pattern.matches(heading_level.value()))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return pseudo_class.levels.contains_slow(heading_level.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue