From 4eda4bbd61f3ae8db78aca1d675ce7a60bacf3c3 Mon Sep 17 00:00:00 2001 From: weisintai Date: Tue, 3 Oct 2023 11:16:17 +0800 Subject: [PATCH] Fix key attribute of list elements not accounting for deleted entries --- lib/ListExtender.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ListExtender.js b/lib/ListExtender.js index 3f2d7a8..f37cbf4 100644 --- a/lib/ListExtender.js +++ b/lib/ListExtender.js @@ -233,6 +233,9 @@ if (canRemove(input.target, thing) && thing.listSize > 1) { thing.element.removeChild(input.target.parentElement); thing.listSize--; + thing.element.childNodes.forEach((e, index) => { + e.setAttribute("key", index + 1); + }); } else if (validate(input.target) && customChecks(input.target, thing)) { turnToList(input.target, thing); }