• Takes advantage of event bubbling to listen for events on descendant elements to reduce the number of listeners to create.

    Parameters

    • matcher: Matcher

      Map of event target matcher to associated handler function

    • Optional wrapListeners: boolean

      Whether to werap the matcher functions with eventListener.

    Returns ((e) => any)

    Example

    table.onclick = matchListener({
    'a.lbl': e => select(e.target.parentNode.parentNode),
    'span.remove': [removeListener, preventDefault, stopPropagation]
    }, true);