From 873c2a8be03dc59dec712f09b04fe88edddcf1ca Mon Sep 17 00:00:00 2001 From: omer Date: Sun, 27 Oct 2019 17:17:36 +0200 Subject: [PATCH] fix(selector): lint fixes --- src/index.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index 9bcf60f4a..ae2b6d023 100644 --- a/src/index.js +++ b/src/index.js @@ -186,24 +186,22 @@ class ReactTooltip extends React.Component { * Pick out corresponded target elements */ getTargetArray (id) { - let targetArray = []; - let selector; + let targetArray = [] + let selector if (!id) { - selector = '[data-tip]:not([data-for])'; + selector = '[data-tip]:not([data-for])' } else { - const escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); - selector = '[data-tip][data-for="' + escaped + '"]'; + const escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + selector = '[data-tip][data-for="' + escaped + '"]' } // Scan document for shadow DOM elements nodeListToArray(document.getElementsByTagName('*')) .filter(element => element.shadowRoot) .forEach(element => { - targetArray = targetArray.concat(nodeListToArray(element.shadowRoot.querySelectorAll(selector))); - }); - - targetArray = targetArray.concat(nodeListToArray(document.querySelectorAll(selector))); - + targetArray = targetArray.concat(nodeListToArray(element.shadowRoot.querySelectorAll(selector))) + }) + targetArray = targetArray.concat(nodeListToArray(document.querySelectorAll(selector))) return targetArray }