From 5ddfb5a19e6192736f47c85d79dfc88c3ec8f06c Mon Sep 17 00:00:00 2001 From: Michael-Hutchinson Date: Tue, 27 Aug 2024 21:00:03 +0100 Subject: [PATCH] fix: Update InitColorSchemeScript to use const and let instead of var --- .../src/InitColorSchemeScript/InitColorSchemeScript.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/mui-system/src/InitColorSchemeScript/InitColorSchemeScript.tsx b/packages/mui-system/src/InitColorSchemeScript/InitColorSchemeScript.tsx index 7320bb7c10af42..98d56aec2de0f5 100644 --- a/packages/mui-system/src/InitColorSchemeScript/InitColorSchemeScript.tsx +++ b/packages/mui-system/src/InitColorSchemeScript/InitColorSchemeScript.tsx @@ -92,10 +92,10 @@ export default function InitColorSchemeScript(options?: InitColorSchemeScriptPro dangerouslySetInnerHTML={{ __html: `(function() { try { - var mode = localStorage.getItem('${modeStorageKey}') || 'system'; - var colorScheme = ''; - var dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}'; - var light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}'; + const mode = localStorage.getItem('${modeStorageKey}') || 'system'; + let colorScheme = ''; + const dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}'; + const light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}'; if (mode === 'system') { // handle system mode var mql = window.matchMedia('(prefers-color-scheme: dark)');