From 35622a0ff3a0ea161f89c2a6921126256addb3b6 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Thu, 21 Jan 2016 09:49:02 -0600 Subject: [PATCH] tab: Fix error when no dropdown is used with tabs If there is no dropdown being used as a tab self.dropdown is null. This results in an error when attempting to test/set the active class on the null dropdown variable. This bug was introduced in commit "Removed `classList` dependency " 7acaaac... --- lib/tab-native.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tab-native.js b/lib/tab-native.js index 3697d3e8..2a7d57d4 100644 --- a/lib/tab-native.js +++ b/lib/tab-native.js @@ -68,10 +68,12 @@ self.addClass(next.parentNode,'active'); // handle dropdown menu "active" class name - if ( !(isDropDown.test(self.tab.parentNode.parentNode.className)) ) { - if (/active/.test(self.dropdown.className)) self.removeClass(self.dropdown,'active'); - } else { - if (!/active/.test(self.dropdown.className)) self.addClass(self.dropdown,'active'); + if ( self.dropdown ) { + if ( !(isDropDown.test(self.tab.parentNode.parentNode.className)) ) { + if (/active/.test(self.dropdown.className)) self.removeClass(self.dropdown,'active'); + } else { + if (!/active/.test(self.dropdown.className)) self.addClass(self.dropdown,'active'); + } } //1. hide current active content first