From 132921e6693ae5492fded334a12c66b82f4b79f9 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 27 Jan 2022 11:41:01 -0800 Subject: [PATCH 1/1] Avoid children[0] --- vopamoi.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vopamoi.ts b/vopamoi.ts index 6cee2a1..8112c4f 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -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) { -- 2.44.1