Skip to content

Commit

Permalink
fix(plugin-comments): optimize Giscus theme recognisation method
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #198
  • Loading branch information
wstee committed Jun 4, 2023
1 parent 24b84a6 commit 3024e63
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineComponent({

onMounted(async () => {
const fn = function() {
const dark = document.querySelector('html')?.className === 'dark'
const dark = document.documentElement.classList?.contains('dark')
// @ts-ignore
if(import.meta.env.PROD) {
const baseUrl = window.location.protocol + '//' + window.location.host
Expand All @@ -40,8 +40,7 @@ export default defineComponent({
}
}
const mutationObserver = new MutationObserver(fn)
/**Element**/
mutationObserver.observe(document.querySelector('html')!, {
mutationObserver.observe(document.documentElement, {
attributes: true,
})
fn()
Expand Down

0 comments on commit 3024e63

Please sign in to comment.