mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-04-25 08:04:33 -05:00
Fix CheckButton causing 'cannot read properties of undefined' on Edge
This commit is contained in:
parent
c809e19e06
commit
c082077660
|
|
@ -86,7 +86,7 @@ class CardButton {
|
|||
el2.appendChild(el3);
|
||||
}
|
||||
|
||||
this.button = new CheckButton(checkBox);
|
||||
this.button = new CheckButton(checkBox, el);
|
||||
|
||||
CardButton.idNumber++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ class CheckButton {
|
|||
readonly input: HTMLInputElement;
|
||||
readonly label: HTMLLabelElement;
|
||||
|
||||
constructor(input: HTMLInputElement) {
|
||||
constructor(input: HTMLInputElement, label?: HTMLLabelElement) {
|
||||
this.input = input;
|
||||
this.label = input.labels![0];
|
||||
this.label = label ?? input.labels![0];
|
||||
this.input.addEventListener('input', () => {
|
||||
this.checked = this.input.checked;
|
||||
});
|
||||
|
|
@ -29,4 +29,4 @@ class CheckButton {
|
|||
else
|
||||
this.label.classList.remove('checked');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function createDeckButton(index: number, deck: Deck) {
|
|||
label.appendChild(document.createTextNode(deck.name));
|
||||
|
||||
deckList.insertBefore(label, addDeckControls);
|
||||
deckButtons.push(new CheckButton(input));
|
||||
deckButtons.push(new CheckButton(input, label));
|
||||
return label;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ function initDeckSelection() {
|
|||
label.appendChild(document.createTextNode(deck.name));
|
||||
|
||||
lobbyDeckList.appendChild(label);
|
||||
const button = new CheckButton(input);
|
||||
const button = new CheckButton(input, label);
|
||||
lobbyDeckButtons.push(button);
|
||||
|
||||
if (!deck.isValid) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user