dom-event-delegation Flashcards
What is the event.target?
the element you interacted with.
Why is it possible to listen for events on one element that actually happen its descendent elements?
because event bubbles.
What DOM element property tells you what type of element it is?
type
What does the element.closest() method take as its argument and what does it return?
css selector, the Element which is the closest ancestor of the selected element. it can also return itself or null.
How can you remove an element from the DOM?
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?
add the event listener on a parent element.