diff --git a/packages/enzyme/src/selectors.js b/packages/enzyme/src/selectors.js index 409c32257..8cb98737f 100644 --- a/packages/enzyme/src/selectors.js +++ b/packages/enzyme/src/selectors.js @@ -355,9 +355,8 @@ export function reduceTreeBySelector(selector, root) { if (typeof selector === 'string') { const tokens = safelyGenerateTokens(selector); let index = 0; - let token = null; while (index < tokens.length) { - token = tokens[index]; + const token = tokens[index]; /** * There are two types of tokens in a CSS selector: * @@ -382,8 +381,7 @@ export function reduceTreeBySelector(selector, root) { // We assume the next token is a selector, so move the index // forward and build the predicate. index += 1; - token = tokens[index]; - const predicate = buildPredicateFromToken(token, root); + const predicate = buildPredicateFromToken(tokens[index], root); // We match against only the nodes which have already been matched, // since a combinator is meant to refine a previous selector. switch (type) {