mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:26:23 -04:00
fix(playground): gracefully fallback to JavaScript if the select info is undefined
Some checks are pending
Deploy Docs / deploy-docs (push) Waiting to run
Some checks are pending
Deploy Docs / deploy-docs (push) Waiting to run
This commit is contained in:
parent
9228a31f94
commit
48fe030bdd
|
|
@ -29,7 +29,11 @@ function initializeCustomSelect({ initialValue = null, addListeners = false }) {
|
|||
if (initialValue) {
|
||||
select.value = initialValue;
|
||||
}
|
||||
selectedValue.textContent = select.options[select.selectedIndex].text;
|
||||
if (select.selectedIndex >= 0 && select.options[select.selectedIndex]) {
|
||||
selectedValue.textContent = select.options[select.selectedIndex].text;
|
||||
} else {
|
||||
selectedValue.textContent = 'JavaScript';
|
||||
}
|
||||
|
||||
if (addListeners) {
|
||||
button.addEventListener('click', (e) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue