diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index a2d85e8986d..f9820cbc170 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -72,14 +72,24 @@ pub fn matches_selector_list( where E: Element { - selector_list.0.iter().any(|selector| { - matches_selector(selector, - 0, - None, - element, - context, - &mut |_, _| {}) - }) + // This is pretty much any(..) but manually inlined because the compiler + // refuses to do so from querySelector / querySelectorAll. + for selector in &selector_list.0 { + let matches = matches_selector( + selector, + 0, + None, + element, + context, + &mut |_, _| {}, + ); + + if matches { + return true; + } + } + + false } #[inline(always)]