Skip to content

Commit

Permalink
[Refactor] selectors: fix typos; avoid reusing variable unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ReactiveRaven authored and ljharb committed Jun 17, 2018
1 parent bda506d commit e2ba4da
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/enzyme/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand All @@ -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) {
Expand Down

0 comments on commit e2ba4da

Please sign in to comment.