Event Delegation

What advantage does this delegation pattern provide?
class DelegateManager {
  constructor(root) {
    this.root = root;
    this.handlers = new Map();
  }
  
  on(eventType, selector, handler) {
    if (!this.handlers.has(eventType)) {
      this.handlers.set(eventType, new Map());
      this.root.addEventListener(eventType, this.handleEvent.bind(this));
    }
    this.handlers.get(eventType).set(selector, handler);
  }
  
  handleEvent(e) {
    const handlers = this.handlers.get(e.type);
    for (const [selector, handler] of handlers) {
      const target = e.target.closest(selector);
      if (target && this.root.contains(target)) {
        handler.call(target, e);
      }
    }
  }
}
Next Question (11/20)