Prevent undefined/false value to be set

This commit is contained in:
Alexander Wåland 2017-06-27 06:56:56 +02:00
parent c84d8194a5
commit db5738fa7d

View file

@ -161,13 +161,13 @@ class Tab extends EventEmitter {
setBadge (badge) {
if (this.isClosed) return;
let span = this.tabElements.badge;
span.innerHTML = badge;
this.badge = badge;
if (!badge) {
span.classList.add('hidden');
} else {
if (badge) {
span.innerHTML = badge;
span.classList.remove('hidden');
} else {
span.classList.add('hidden');
}
this.emit("badge-changed", badge, this);