From 41f3103a166eae4197ae59f6fa3bf64ab2d40d0f Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 17 Dec 2017 21:57:26 +0300 Subject: [PATCH] code cosmetics: use closest() in messageBox --- msgbox/msgbox.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/msgbox/msgbox.js b/msgbox/msgbox.js index 3862e039..a9470c46 100644 --- a/msgbox/msgbox.js +++ b/msgbox/msgbox.js @@ -40,10 +40,8 @@ function messageBox({ } switch (which) { case 13: - for (let el = target; el; el = el.parentElement) { - if (focusAccessibility.ELEMENTS.includes(el.localName)) { - return; - } + if (target.closest(focusAccessibility.ELEMENTS.join(','))) { + return; } break; case 27: