From db5738fa7dc21e3e3f865072658787f2064793b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20W=C3=A5land?= Date: Tue, 27 Jun 2017 06:56:56 +0200 Subject: [PATCH] Prevent undefined/false value to be set --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index ff44f3a..6ef0f0f 100644 --- a/index.js +++ b/index.js @@ -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);