Merge pull request #1651 from notriddle/notriddle/theme-switcher-js

Only switch to themes on buttons that have the `theme` class
This commit is contained in:
Eric Huss 2021-09-16 17:32:01 -07:00 committed by GitHub
commit 601ebc5499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -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);
});