Skip to content

Commit

Permalink
Merge pull request #1651 from notriddle/notriddle/theme-switcher-js
Browse files Browse the repository at this point in the history
Only switch to themes on buttons that have the `theme` class
  • Loading branch information
ehuss committed Sep 17, 2021
2 parents 93008cf + 4251d7a commit 601ebc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/theme/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,14 @@ function playground_text(playground) {
});

themePopup.addEventListener('click', function (e) {
var theme = e.target.id || e.target.parentElement.id;
var theme;
if (e.target.className === "theme") {
theme = e.target.id;
} else if (e.target.parentElement.className === "theme") {
theme = e.target.parentElement.id;
} else {
return;
}
set_theme(theme);
});

Expand Down

0 comments on commit 601ebc5

Please sign in to comment.