diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-02 20:49:27 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-02 20:49:27 -0700 |
commit | 10cc10e0e88569cc48d86e9ab4d90538683bfaf6 (patch) | |
tree | cb2dbb65a5c914e41f75175316efa6ddcd086997 /modern/src/map/switcher/switcher.js | |
parent | 8d953869da0b79941987ab1dc6eb00e643ee5d81 (diff) | |
download | trackermap-web-10cc10e0e88569cc48d86e9ab4d90538683bfaf6.tar.gz trackermap-web-10cc10e0e88569cc48d86e9ab4d90538683bfaf6.tar.bz2 trackermap-web-10cc10e0e88569cc48d86e9ab4d90538683bfaf6.zip |
Handle missing string
Diffstat (limited to 'modern/src/map/switcher/switcher.js')
-rw-r--r-- | modern/src/map/switcher/switcher.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modern/src/map/switcher/switcher.js b/modern/src/map/switcher/switcher.js index cb7326f4..c239662a 100644 --- a/modern/src/map/switcher/switcher.js +++ b/modern/src/map/switcher/switcher.js @@ -29,7 +29,9 @@ export class SwitcherControl { const styleElement = document.createElement('button'); styleElement.type = 'button'; styleElement.innerText = style.title; - styleElement.classList.add(style.title.replace(/[^a-z0-9-]/gi, '_')); + if (style.title) { + styleElement.classList.add(style.title.replace(/[^a-z0-9-]/gi, '_')); + } styleElement.dataset.uri = JSON.stringify(style.uri); styleElement.addEventListener('click', (event) => { const { srcElement } = event; |