Web Dev Solutions

Catalin Mititiuc

From bb403234f7d748499091e84a5f80d2f1394a4dc3 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Tue, 2 Jul 2024 17:33:16 -0700 Subject: Fix deselecting when counter is not on the board --- src/modules/gameboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js index a6b3e22..be725b5 100644 --- a/src/modules/gameboard.js +++ b/src/modules/gameboard.js @@ -171,7 +171,7 @@ function selectOffBoard() { function select(data) { const counter = data && (soldier.getCounter(svg, data) || soldier.createCounter(data)); - const isSelected = counter?.classList.contains(soldier.getSelectedClass()); + const isSelected = data && data.classList && data.classList.contains('selected'); deselect(); -- cgit v1.2.3