src/core/events.js
function(element, selector, event, callback, capturePhase) {
    const delegateElement = $(element).array[0]
    $(element).forEach(function(ctx) {
      $(ctx).on(event, function(e) {
        let target = e.target
        if (e.target.nodeType === 3) {
          target = e.target.parentNode
        }
        $(ctx).find(selector).forEach(function(delegateElement) {
          if (delegateElement === target) {
            callback.call(delegateElement, e)
          } else {
            try {
              const ancestor = $(target).closest(selector)
              if (delegateElement === ancestor.array[0]) {
                callback.call(delegateElement, e)
              }
            } catch (err) {}
          }
        })
      }, capturePhase)
    })
  }
function(element, selector, event, callback, capturePhase) {
    const delegateElement = $(element).array[0]
    $(element).forEach(function(ctx) {
      $(ctx).on(event, function(e) {
        let target = e.target
        if (e.target.nodeType === 3) {
          target = e.target.parentNode
        }
        $(ctx).find(selector).forEach(function(delegateElement) {
          if (delegateElement === target) {
            callback.call(delegateElement, e)
          } else {
            try {
              const ancestor = $(target).closest(selector)
              if (delegateElement === ancestor.array[0]) {
                callback.call(delegateElement, e)
              }
            } catch (err) {}
          }
        })
      }, capturePhase)
    })
  }
function ( element , selector , event , callback , capturePhase ) { const delegateElement = $ ( element ) . array [ 0 ] $ ( element ) . forEach ( function ( ctx ) { $ ( ctx ) . on ( event , function ( e ) { let target = e . target if ( e . target . nodeType === 3 ) { target = e . target . parentNode } $ ( ctx ) . find ( selector ) . forEach ( function ( delegateElement ) { if ( delegateElement === target ) { callback . call ( delegateElement , e ) } else { try { const ancestor = $ ( target ) . closest ( selector ) if ( delegateElement === ancestor . array [ 0 ] ) { callback . call ( delegateElement , e ) } } catch ( err ) { } } } ) } , capturePhase ) } ) }
Set delegated events on ChuiEventCache
Set delegated events on ChuiEventCache