chettigari naveen1,198 Points
why not to target the UL element instead of DIV, so we can stop using IF block
please provide reason for using DIV when we have list items parent UL.
Steven Parker207,988 Points
You would still want an "if" to filter on specific elements even if the delegated handler were placed closer, since it would also get triggered by events on children of the list items.
Another good reason to apply the filter is to prevent unexpected behavior changes from future additions to the HTML.
Ivan KazakovCourses Plus Student 43,317 Points
Still adding an event listener to the
<ul> makes sense to me, even though it doesn't eliminate the necessity to check for the target. Makes less event handling in the DOM, since `
<button> aren't included in that case.