ker/mod/interact.js
function delegateListener (event, useCapture) {
        var fakeEvent = {},
            delegated = delegatedEvents[event.type],
            eventTarget = getActualElement(event.path
                                           ? event.path[0]
                                           : event.target),
            element = eventTarget;

        useCapture = useCapture? true: false;

        // duplicate the event so that currentTarget can be changed
        for (var prop in event) {
            fakeEvent[prop] = event[prop];
        }

        fakeEvent.originalEvent = event;
        fakeEvent.preventDefault = preventOriginalDefault;

        // climb up document tree looking for selector matches
        while (isElement(element)) {
            for (var i = 0; i < delegated.selectors.length; i++) {
                var selector = delegated.selectors[i],
                    context = delegated.contexts[i];

                if (matchesSelector(element, selector)
                    && nodeContains(context, eventTarget)
                    && nodeContains(context, element)) {

                    var listeners = delegated.listeners[i];

                    fakeEvent.currentTarget = element;

                    for (var j = 0; j < listeners.length; j++) {
                        if (listeners[j][1] === useCapture) {
                            listeners[j][0](fakeEvent);
                        }
                    }
                }
            }

            element = parentElement(element);
        }
    }
function delegateListener (event, useCapture) {
        var fakeEvent = {},
            delegated = delegatedEvents[event.type],
            eventTarget = getActualElement(event.path
                                           ? event.path[0]
                                           : event.target),
            element = eventTarget;

        useCapture = useCapture? true: false;

        // duplicate the event so that currentTarget can be changed
        for (var prop in event) {
            fakeEvent[prop] = event[prop];
        }

        fakeEvent.originalEvent = event;
        fakeEvent.preventDefault = preventOriginalDefault;

        // climb up document tree looking for selector matches
        while (isElement(element)) {
            for (var i = 0; i < delegated.selectors.length; i++) {
                var selector = delegated.selectors[i],
                    context = delegated.contexts[i];

                if (matchesSelector(element, selector)
                    && nodeContains(context, eventTarget)
                    && nodeContains(context, element)) {

                    var listeners = delegated.listeners[i];

                    fakeEvent.currentTarget = element;

                    for (var j = 0; j < listeners.length; j++) {
                        if (listeners[j][1] === useCapture) {
                            listeners[j][0](fakeEvent);
                        }
                    }
                }
            }

            element = parentElement(element);
        }
    }
function delegateListener ( event , useCapture ) { var fakeEvent = { } , delegated = delegatedEvents [ event . type ] , eventTarget = getActualElement ( event . path ? event . path [ 0 ] : event . target ) , element = eventTarget ; useCapture = useCapture ? true : false ; // duplicate the event so that currentTarget can be changed for ( var prop in event ) { fakeEvent [ prop ] = event [ prop ] ; } fakeEvent . originalEvent = event ; fakeEvent . preventDefault = preventOriginalDefault ; // climb up document tree looking for selector matches while ( isElement ( element ) ) { for ( var i = 0 ; i < delegated . selectors . length ; i ++ ) { var selector = delegated . selectors [ i ] , context = delegated . contexts [ i ] ; if ( matchesSelector ( element , selector ) && nodeContains ( context , eventTarget ) && nodeContains ( context , element ) ) { var listeners = delegated . listeners [ i ] ; fakeEvent . currentTarget = element ; for ( var j = 0 ; j < listeners . length ; j ++ ) { if ( listeners [ j ] [ 1 ] === useCapture ) { listeners [ j ] [ 0 ] ( fakeEvent ) ; } } } } element = parentElement ( element ) ; } }
bound to the interactable context when a DOM event listener is added to a selector interactable
bound to the interactable context when a DOM event listener is added to a selector interactable