From f0999365e294c9ae01cfe3920cef3e7685352cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 27 Oct 2017 14:01:18 +0200 Subject: [PATCH] style: Bump the selector length heuristic. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A selector with combinators has to have length > 2 (a component, a combinator, another component). MozReview-Commit-ID: GvMEbRdOVi2 Signed-off-by: Emilio Cobos Álvarez --- components/style/dom_apis.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index bf4f571f21d..41c5c19dca8 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -557,8 +557,11 @@ where // // We could do that check properly here, though checking the length of the // selectors is a good heuristic. + // + // A selector with a combinator needs to have a length of at least 3: A + // simple selector, a combinator, and another simple selector. let invalidation_may_be_useful = - selector_list.0.iter().any(|s| s.len() > 1); + selector_list.0.iter().any(|s| s.len() > 2); if root_element.is_some() || !invalidation_may_be_useful { query_selector_slow::(