Skip to content

Commit

Permalink
fix: initialize script on the case of disabling color toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jan 27, 2023
1 parent dbe5b0a commit 91616ae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions assets/js/mode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ class ModeToggle implements Component {
}
});

const icon = document
.querySelector('.mode-item[data-color-mode="' + mode + '"] .mode-icon')
.cloneNode(true) as HTMLElement;
icon.setAttribute('id', 'modeIcon');
document.querySelector('#modeIcon').replaceWith(icon);
const icon = document.querySelector('.mode-item[data-color-mode="' + mode + '"] .mode-icon')?.cloneNode(true) as HTMLElement;
icon?.setAttribute('id', 'modeIcon');
document.querySelector('#modeIcon')?.replaceWith(icon);
}

setMode(value: string) {
Expand Down

0 comments on commit 91616ae

Please sign in to comment.