-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
todo list #4
base: master
Are you sure you want to change the base?
todo list #4
Conversation
e.target.remove(); | ||
} | ||
else{ | ||
e.target.style = 'text-decoration : line-through'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a bug 😢
} | ||
}); | ||
|
||
for(let butt of document.querySelectorAll("button")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language!
}); | ||
|
||
for(let butt of document.querySelectorAll("button")){ | ||
butt.addEventListener("click", e =>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since each button is an individual controller for a distinct action, we should add event listeners to them individually, not in a loop.
} | ||
|
||
|
||
document.getElementById("write_item") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not listen to form's change
event and check if form is valid? This opens up the door for new "validation" bugs.
|
||
document.getElementById("write_item") | ||
.addEventListener("input", e =>{ | ||
if(e.target.value !== "" && e.target.value !== "Write up your todo here"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value you see is called "placeholder". It's not literally a value.
document.querySelector("ul").prepend(item); | ||
document.getElementById("write_item").value = "Write up your todo here"; | ||
document.getElementById("write_item").style.width = ''; | ||
document.getElementById("add").disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a form's .reset()
method
} | ||
}); | ||
|
||
document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why reimplement the focus
mechanism? Add tabindex=0
to the elements :)
@@ -14,11 +14,19 @@ <h1>ExCo.</h1> | |||
</header> | |||
<main> | |||
<h2>My Todos List</h2> | |||
<form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why not use a section? :(
<ul> | ||
<li>Have morning coffee</li> | ||
<li>Eat lunch</li> | ||
<li>Make awesome things happen</li> | ||
</ul> | ||
<span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A span instead of a section? A SPAN?!?! 😭
No description provided.