From: Scott Worley Date: Thu, 27 Jan 2022 19:41:01 +0000 (-0800) Subject: Avoid children[0] X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/132921e6693ae5492fded334a12c66b82f4b79f9?ds=sidebyside Avoid children[0] --- 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) {