mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
perf: optimize dom selectors for better performance
This commit is contained in:
parent
bfe3771571
commit
beb3386edc
10 changed files with 26 additions and 23 deletions
|
@ -112,7 +112,7 @@ function isCurrentDark() {
|
|||
function initTheme(doc = document) {
|
||||
const isDark = isCurrentDark()
|
||||
doc.documentElement.classList.toggle('dark', isDark)
|
||||
const metaTheme = doc.querySelector('meta[name="theme-color"]')
|
||||
const metaTheme = doc.head.querySelector('meta[name="theme-color"]')
|
||||
if (metaTheme) {
|
||||
metaTheme.setAttribute('content', isDark ? darkMode : lightMode)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue