From 3fd63e1474d85aeeb382909affd76eb9fa504092 Mon Sep 17 00:00:00 2001 From: MattMo Date: Tue, 4 May 2021 14:24:40 -0700 Subject: [PATCH] Renamed js to ignite-html-tabs. Added null check on element. --- ignite-tabs.js => ignite-html-tabs.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) rename ignite-tabs.js => ignite-html-tabs.js (85%) diff --git a/ignite-tabs.js b/ignite-html-tabs.js similarity index 85% rename from ignite-tabs.js rename to ignite-html-tabs.js index fd2d12d..b83ab75 100644 --- a/ignite-tabs.js +++ b/ignite-html-tabs.js @@ -14,17 +14,19 @@ IgniteTemplate.prototype.tab = function(name, active = false) { //the tabchange event is raised. Upon disconnecting the callback we remove //the event listener. var callback = new IgniteCallback(e => { - if (e.tabName == name) { - this.element.classList.remove("tab-inactive"); + if (this.element) { + if (e.tabName == name) { + this.element.classList.remove("tab-inactive"); - if (!this.element.classList.contains("tab-active")) { - this.element.classList.add("tab-active"); - } - } else { - this.element.classList.remove("tab-active"); + if (!this.element.classList.contains("tab-active")) { + this.element.classList.add("tab-active"); + } + } else { + this.element.classList.remove("tab-active"); - if (!this.element.classList.contains("tab-inactive")) { - this.element.classList.add("tab-inactive"); + if (!this.element.classList.contains("tab-inactive")) { + this.element.classList.add("tab-inactive"); + } } } }, () => {