perf: optimize dom selectors for better performance

This commit is contained in:
radishzzz 2025-05-19 03:12:55 +01:00
parent bfe3771571
commit beb3386edc
10 changed files with 26 additions and 23 deletions

View file

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