From c573bd0856944dfb4b3efbf22216bbbf87f53e7f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 12 Jul 2020 16:26:45 +0100 Subject: [PATCH] prep for halo --- templates/script.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 10633b6d..b8eca386 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -233,8 +233,13 @@ function set_ungrab(piece: PieceId, p: PieceInfo) { piece_undisplay_grab(piece,p); } function piece_undisplay_grab(piece: PieceId, p: PieceInfo) { - while (p.pelem.children.length > 1) { - p.pelem.lastElementChild!.remove(); + for (let celem = p.pelem.firstElementChild; + celem != null; + celem = celem.nextElementSibling) { + if (celem.getAttributeNS(null,"href") == "#select"+piece) { + celem.remove(); + return; + } } } -- 2.30.2