Bug 1891296 - Fix an assertion in selector-matching. r=dshin

We can have combinator sequences like [>, <part>], and they are fine.

Add a test to make sure they're handled correctly.

Differential Revision: https://phabricator.services.mozilla.com/D208668
This commit is contained in:
Emilio Cobos Álvarez
2024-04-25 19:35:10 +00:00
parent d24d23ff86
commit e6342609f5
3 changed files with 30 additions and 6 deletions

View File

@@ -362,12 +362,7 @@ where
let iter = selector.iter_from(selector.len() - from_offset);
debug_assert!(
iter.clone().next().is_some() ||
(from_offset != selector.len() &&
matches!(
selector.combinator_at_parse_order(from_offset),
Combinator::SlotAssignment | Combinator::PseudoElement
)),
iter.clone().next().is_some() || from_offset != selector.len(),
"Got the math wrong: {:?} | {:?} | {} {}",
selector,
selector.iter_raw_match_order().as_slice(),