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,6 +14,7 @@ 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 (this.element) {
if (e.tabName == name) {
this.element.classList.remove("tab-inactive");
@ -27,6 +28,7 @@ IgniteTemplate.prototype.tab = function(name, active = false) {
this.element.classList.add("tab-inactive");
}
}
}
}, () => {
window.removeEventListener("tabchange", callback.callback);
});