Creating Custom Events

When should you use event delegation with custom events?
document.addEventListener('custom:action', function(e) {
  if (e.target.matches('.interactive-element')) {
    const action = e.target.dataset.action;
    const id = e.target.dataset.id;
    
    handleAction(action, id, e.detail);
  }
});
Next Question (13/20)