From 9f73576f6a61b3f1866d5eb509b849f6ad5aea36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 29 Apr 2019 05:58:56 +0000 Subject: [PATCH] style: Check iterator length in SelectorIter::is_featureless_host_selector. I'm going to unconditionally generate the PseudoElement combinator, and this causes issues since we'll put the raw `::pseudo` selectors in the host bucket, which is obviously wrong. Differential Revision: https://phabricator.services.mozilla.com/D27528 --- components/selectors/parser.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index e3afab57e16..21459e4e46d 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -736,7 +736,8 @@ impl<'a, Impl: 'a + SelectorImpl> SelectorIter<'a, Impl> { /// combinators to the left. #[inline] pub(crate) fn is_featureless_host_selector(&mut self) -> bool { - self.all(|component| matches!(*component, Component::Host(..))) && + self.selector_length() > 0 && + self.all(|component| matches!(*component, Component::Host(..))) && self.next_sequence().is_none() }