mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 02:38:27 -04:00
use safer CSS.insertRule instead of innerHTML for dark mode transition hack
This commit is contained in:
parent
081864d091
commit
d5088e1982
@ -2,13 +2,14 @@ import { init as initDarkMode } from "dark-mode-switcheroo";
|
||||
|
||||
// HACK: disable theme transition until user's preference is auto-restored (1/2)
|
||||
const disableTransitionCSSHack = document.createElement("style");
|
||||
disableTransitionCSSHack.innerHTML = `
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
transition-property: none !important;
|
||||
}`;
|
||||
document.head.appendChild(disableTransitionCSSHack);
|
||||
disableTransitionCSSHack.sheet.insertRule(`
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
transition-property: none !important;
|
||||
}
|
||||
`);
|
||||
|
||||
initDarkMode({
|
||||
toggle: document.querySelector(".dark-mode-toggle"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user