mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
prevent error when theme selector isn't present
This commit is contained in:
@@ -26,7 +26,7 @@ async function updateTheme(value, isInitialLoad = false) {
|
||||
|
||||
// Get brand and palette from the selected option
|
||||
const themeSelector = document.querySelector('.theme-selector');
|
||||
const selectedOption = themeSelector.querySelector(`wa-option[value="${value}"]`);
|
||||
const selectedOption = themeSelector?.querySelector(`wa-option[value="${value}"]`);
|
||||
const brand = selectedOption?.getAttribute('data-brand') || 'blue';
|
||||
const palette = selectedOption?.getAttribute('data-palette') || 'default';
|
||||
const htmlElement = document.documentElement;
|
||||
|
||||
Reference in New Issue
Block a user