From 3e000fbe9d7921ffbb31b7c6db81a8a824a44c95 Mon Sep 17 00:00:00 2001 From: qjas Date: Wed, 5 Apr 2017 18:12:56 +0800 Subject: [PATCH] Remove spurious check in DomUtil.preventOutline (#5435) The codes first execute "element.tabIndex"(show that element is not NULL), then execute "!element" in the condition of if stmt(check whether the element is NULL or not). It is a contradiction. I think since the element must not be NULL(otherwise the execution of "element.tabIndex" would be wrong) when the while stmt finishes, the next if stmt doesn't need to check the element like "!element" again. Checking the element.style is already enough. So remove the "!element". --- src/dom/DomUtil.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dom/DomUtil.js b/src/dom/DomUtil.js index 7024a793..a1b6a21a 100644 --- a/src/dom/DomUtil.js +++ b/src/dom/DomUtil.js @@ -297,7 +297,7 @@ export function preventOutline(element) { while (element.tabIndex === -1) { element = element.parentNode; } - if (!element || !element.style) { return; } + if (!element.style) { return; } restoreOutline(); _outlineElement = element; _outlineStyle = element.style.outline;