Skip to content

Commit

Permalink
style: remove empty element.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 25, 2022
1 parent d08960c commit 5c32eb7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class DarkMode extends HTMLElement {
_changeContent() {
this.icon.textContent = this.mode === LIGHT ? '🌒' : '🌞';
this.text.textContent = this.mode === LIGHT ? this.getAttribute(DARK) : this.getAttribute(LIGHT);
if (!this.text.textContent && this.text.parentElement && this.text) {
this.text.parentElement.removeChild(this.text)
}
}
_initializeDOM() {
var shadow = this.attachShadow({ mode: 'open' });
Expand Down

0 comments on commit 5c32eb7

Please sign in to comment.