From 00a5f27bebfecd39e5cf718e123573e38085b318 Mon Sep 17 00:00:00 2001 From: Daniel Hug Date: Fri, 31 Mar 2017 22:23:23 -0700 Subject: [PATCH] remove unnecessary lines --- panels.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/panels.js b/panels.js index 8c21a60..820c002 100644 --- a/panels.js +++ b/panels.js @@ -7,7 +7,7 @@ var el = HTMLElement.prototype; var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector; - function closestParent(el, selector) { + return function(el, selector) { while (el && el.nodeType === 1) { if (matches.call(el, selector)) { return el; @@ -15,8 +15,7 @@ el = el.parentNode; } return null; - } - return closestParent; + }; })(); @@ -54,8 +53,8 @@ return a === b || b.contains(a); } - function tabClick(clickedTab) { - clickedTab = clickedTab.parentNode ? clickedTab : this; + delegateEvent('.tab', 'click', function() { + var clickedTab = this; var parent = closestParent(clickedTab, '.tabbed-panels'); if (!parent) return; @@ -83,9 +82,7 @@ panel.classList.remove('active'); } }); - } - - delegateEvent('.tab', 'click', tabClick); + }); window.addEventListener('click', function(event) { var parents = [].slice.call(document.querySelectorAll('.tabbed-panels.hovering.closeable.active'));