Skip to content

Commit

Permalink
remove unnecessary lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Hug committed Apr 1, 2017
1 parent 1502675 commit 00a5f27
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
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;
}
el = el.parentNode;
}
return null;
}
return closestParent;
};
})();


Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit 00a5f27

Please sign in to comment.