Skip to content

Commit 6b3aaea

Browse files
committed
simplify insert
1 parent d2ad2db commit 6b3aaea

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

public/client.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ export function open({hash} = {}) {
146146
items.forEach((item) => {
147147
switch (item.type) {
148148
case "html":
149-
if (root.children.length === 0) {
150-
root.insertAdjacentHTML("beforeend", item.html);
151-
} else if (newPos < root.children.length) {
149+
if (newPos < root.children.length) {
152150
root.children[newPos].insertAdjacentHTML("beforebegin", item.html);
153151
} else {
154-
root.lastElementChild.insertAdjacentHTML("afterend", item.html);
152+
root.insertAdjacentHTML("beforeend", item.html);
155153
}
156154
++newPos;
157155
item.cellIds.forEach((id) => {

0 commit comments

Comments
 (0)