style: Don't use the invalidation machinery unless we may get some benefit from it.

MozReview-Commit-ID: 8Wpn2bjuHBQ
This commit is contained in:
Emilio Cobos Álvarez 2017-10-22 03:14:13 +02:00
parent 6b3821ae27
commit dd7196949f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -340,7 +340,14 @@ where
let root_element = root.as_element();
matching_context.scope_element = root_element.map(|e| e.opaque());
if root_element.is_some() {
// The invalidation mechanism is only useful in presence of combinators.
//
// We could do that check properly here, though checking the length of the
// selectors is a good heuristic.
let invalidation_may_be_useful =
selector_list.0.iter().any(|s| s.len() > 1);
if root_element.is_some() || !invalidation_may_be_useful {
query_selector_slow::<E, Q>(
root,
selector_list,