addTag: function (createTimestamp: string, tagName: string): Element | null {
const task = this.getTask(createTimestamp);
if (!task) return null;
addTag: function (createTimestamp: string, tagName: string): Element | null {
const task = this.getTask(createTimestamp);
if (!task) return null;
const tag = document.createElement("span");
tag.appendChild(document.createTextNode(tagName));
tag.classList.add("tag");
const tag = document.createElement("span");
tag.appendChild(document.createTextNode(tagName));
tag.classList.add("tag");
for (const child of task.children) {
if (child.classList.contains("tag") && child.textContent === tag) {
for (const child of task.children) {
if (child.classList.contains("tag") && child.textContent === tag) {
return {
addTask: function (event: KeyboardEvent) {
const input = <HTMLInputElement>document.getElementById("taskName");
return {
addTask: function (event: KeyboardEvent) {
const input = <HTMLInputElement>document.getElementById("taskName");
const input = document.createElement("input");
input.classList.add("tag");
input.addEventListener("blur", this.completeTagEdit, { once: true });
const input = document.createElement("input");
input.classList.add("tag");
input.addEventListener("blur", this.completeTagEdit, { once: true });
task.focus();
if (!Model.hasTag(task, newTagName)) {
ui.addTag(task.getAttribute("data-created")!, newTagName);
task.focus();
if (!Model.hasTag(task, newTagName)) {
ui.addTag(task.getAttribute("data-created")!, newTagName);