What's the advantage of using closest() over matches() in event delegation?
closest() is superior to matches() in event delegation because it finds the nearest matching ancestor (including the element itself), making it better at handling clicks on nested elements. This is crucial because: 1) When clicking text or icons inside a target element, e.target will be the nested element, not the main target, 2) matches() would fail in this case as it only checks the clicked element itself, 3) closest() automatically traverses up the DOM tree until it finds a match, 4) This makes the delegation code more robust and reliable with complex DOM structures.