DOM Event Delegation Flashcards
What is the event.target?
It is basically the element in which an event occurs and is dispatching from
Why is it possible to listen for events on one element that actually happens its descendent elements?
Event bubbling
What DOM element property tells you what type of element it is?
The tagName property
What does the element.closest() method take as its argument and what does it return?
It takes in a selector and returns what element is the closest ancestor is to the selector
How can you remove an element from the DOM?
The element.remove() method
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?
Through event delegation, basically adding the event listener to the parent element