1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-21 21:25:25 +02:00

clean up comments

This commit is contained in:
Morris Brodersen
2023-11-26 14:31:37 +01:00
parent c91b27980e
commit 2815a1eb4c
9 changed files with 54 additions and 47 deletions

View File

@@ -32,9 +32,13 @@ export function TodoItem(el) {
el.querySelectorAll('.app-icon').forEach(AppIcon);
checkboxEl.addEventListener('touchstart', () => {
saveOnBlur = false;
});
checkboxEl.addEventListener(
'touchstart',
() => {
saveOnBlur = false;
},
{ passive: true },
);
checkboxEl.addEventListener('mousedown', () => {
saveOnBlur = false;
@@ -62,10 +66,10 @@ export function TodoItem(el) {
inputEl.addEventListener('keyup', (e) => {
switch (e.keyCode) {
case 13: // enter
case 13: // Enter
save();
break;
case 27: // escape
case 27: // Escape
cancelEdit();
break;
}
@@ -100,7 +104,7 @@ export function TodoItem(el) {
const label = inputEl.value.trim();
if (label === '') {
// deferred deletion prevents a bug at reconciliation in TodoList:
// Deferred deletion prevents a bug at reconciliation in TodoList:
// Failed to execute 'removeChild' on 'Node': The node to be removed is
// no longer a child of this node. Perhaps it was moved in a 'blur'
// event handler?
@@ -137,8 +141,6 @@ export function TodoItem(el) {
}
function update() {
// TODO optimize
el.classList.toggle('-done', item.done);
checkboxEl.querySelector('input').checked = item.done;
labelEl.innerText = item.label;