]> git.scottworley.com Git - vopamoi/commitdiff
Avoid children[0]
authorScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 19:41:01 +0000 (11:41 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:22:18 +0000 (12:22 -0800)
vopamoi.ts

index 6cee2a175c0f51748f5940f31bfd66fec660a11e..8112c4f009930309acf373a69e1581f57dc1e486 100644 (file)
@@ -46,7 +46,7 @@ const Model = {
     if (!target) return null;
     if (target.hasAttribute("data-description")) {
       // Oh no: An edit has arrived from a replica while a local edit is in progress.
-      const input = target.children[0] as HTMLInputElement;
+      const input = target.firstChild as HTMLInputElement;
       if (
         input.value === target.getAttribute("data-description") &&
         input.selectionStart === input.value.length &&
@@ -223,7 +223,7 @@ function BrowserUI() {
       const oldDescription = task.getAttribute("data-description")!;
       const newDescription = input.value;
       input.removeEventListener("blur", this.completeEdit);
-      task.removeChild(task.children[0]);
+      task.removeChild(input);
       task.removeAttribute("data-description");
       task.focus();
       if (newDescription === oldDescription || resolution === CommitOrAbort.Abort) {