X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/1f300e109962a47d2e1928018ea220d98dd0ab26..132921e6693ae5492fded334a12c66b82f4b79f9:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index a76db5b..8112c4f 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -33,7 +33,7 @@ const Model = { addTask: function (timestamp: string, description: string): Element { const task = document.createElement("div"); task.appendChild(document.createTextNode(description)); - task.setAttribute("class", "task"); + task.classList.add("task"); task.setAttribute("tabindex", "0"); task.setAttribute("data-created", timestamp); task.setAttribute("data-state", "todo"); @@ -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 && @@ -115,14 +115,14 @@ function Log(prefix: string = "vp-") { const [createTimestamp, description] = splitN(data, " ", 1); return Model.edit(createTimestamp, description); } - if (command == "State") { - const [createTimestamp, state] = splitN(data, " ", 1); - return Model.setState(timestamp, createTimestamp, state); - } if (command == "Priority") { const [createTimestamp, newPriority] = splitN(data, " ", 1); return Model.setPriority(createTimestamp, parseFloat(newPriority)); } + if (command == "State") { + const [createTimestamp, state] = splitN(data, " ", 1); + return Model.setState(timestamp, createTimestamp, state); + } }, record: function (entry: string) { @@ -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) {