diff --git a/src/theme/book.js b/src/theme/book.js index 79d40354..d40440c7 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -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); });