Renamed js to ignite-html-tabs. Added null check on element.

This commit is contained in:
MattMo 2021-05-04 14:24:40 -07:00
parent fdb0733b31
commit 3fd63e1474

View File

@ -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");
}
}
}
}, () => {