This project is provided by Odin.
Here I set out to reinforce the following skills:
- Webpack Usage
- Dynamic DOM Rendering
- The SOLID Pattern
- Rendering elements with event listeners:
- Returning or exporting innerHTML removes all event listeners.
I overcame this behavior by returning the node itself.
- Returning or exporting innerHTML removes all event listeners.
- Form removal when licking outside the form:
- Solved by adding a
mousein
andmouseout
triggers and listening for a click on the parent container. (mouseout
andmouseleave
differ with thatmouseout
bubbles up whilemouseleave
doesn't. Same formousein
andmouseenter
).
- Solved by adding a
- Form didn't disappear on first click:
- You can fire the event by yourself with functions like
element.click()
.
- You can fire the event by yourself with functions like
localStorage
doesn't store object functions:- Upon object array retrieval, firstly
JSON.parse
, thenmap(task => new Task(...task))
;
- Upon object array retrieval, firstly
- Can't refresh only one part of the page upon change:
- Export a function instead of a Node, this allows you to call the function, thereby re-assign all the variables in the component.
- Change detection is done using MutationObserver
- No id on refresh:
localStorage
has an extra parameter oflastID
stored, it is being dictated by the lastTask
created.
keydown
andfocusout
events collision- When an enter key was pressed, the page reloaded. On page reload, the
focusout
event fired. the solution is rather simple. If anenter key
is pressed, remove thefocusout
listener.
- When an enter key was pressed, the page reloaded. On page reload, the