Dom-event-delegation-Q&A Flashcards
What is the event.target?
The read-only target property of the Event interface is a reference to the object onto which the event was dispatched.
Why is it possible to listen for events on one element that actually happen its descendent elements?
Because of event bubbling
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?
It takes a css selector, and returns the closest matching ancestor
How can you remove an element from the DOM?
Element.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 adding functionality to the parent element then listen for child element events