DOM Event Delegation Flashcards
What is the event.target?
the target that appears when the eventlistner occurs
Why is it possible to listen for events on one element that actually happen its descendent elements?
because they happen inside each other and that’s what the event listener looks for actions inside itself
What DOM element property tells you what type of element it is?
tagName
What does the element.closest() method take as its argument and what does it return?
selector and nearest ancestor
How can you remove an element from the DOM?
remove()
If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?
by creating a function that waits for a single event listener to create its actions.