Outro exemplo na delegação de eventos JavaScript

	function delegate(el, selector, fn)
	{
		el.addEventListener("click", function(){
			if(event.target.matches(selector))			
{
	fn()
}
		})
}
	window.onload = function(){
		let first = document.getElementById("first");
		delegate(first, "button", function(){alert("DFREXXXXXXXXX")});
}
Javasper