Otro ejemplo en JavaScript Event Delegation
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