code: function delegateCallback(eventName, selector, callback) {
      if (!isFunction(callback)) {
          throw new TypeError('Invalid callback for event.');
      }
      const events = this.events;
      const callbacks = events[eventName] ? events[eventName].callbacks : [];
      callbacks.push({
          selector,
          callback,
      });
      const eventCallback = (ev) => {
          let stopped = false;
          const originalStopPropagation = ev.stopPropagation;
          ev.stopPropagation = () => {
              stopped = true;
              return originalStopPropagation.call(ev);
          };
          callbacks
              // check valid target for the event.
              .map((desc) => {
                  let target = checkDelegate(ev, this.node, desc.selector);
                  if (target) {
                      return {
                          target,
                          callback: desc.callback,
                      };
                  }
              })
              .filter((desc) => !!desc)
              // reorder targets by position in the dom tree.
              .sort((desc1, desc2) => (desc1.target.contains(desc2.target) ? 1 : -1))
              // trigger the callback
              .forEach((desc) => {
                  if (!stopped) {
                      desc.callback.call(this, ev, desc.target);
                  }
              });
      };
      eventCallback.callbacks = callbacks;
      events[eventName] = eventCallback;
      return eventCallback;
  }
docs: Generate a delegate listener for an event.
  @private
  
  @param {String} eventName The Event name to register.
  @param {String} selector The CSS selector to match.
  @param {Function} callback The original callback for the event.
  @return {Function} Wrapped callback with a delegation check.