nl_tokens: 为HTML元素添加事件代理
pl_tokens: function addDelegate ( el , selector , type , handler ) { var capture = arguments . length > 4 && arguments [ 4 ] !== undefined ? arguments [ 4 ] : false ; if ( capture !== undefined && ! isBoolean ( capture ) && supportsPassive ) { capture = { passive : true } ; } var handlerWrap = function handlerWrap ( e ) { var targetElsArr = findParents ( e . target || e . srcElement , el , true ) ; var targetElArr = <mask> ( selector , el , true ) ; var retEl = void 0 ; if ( targetElArr . find ) { retEl = targetElArr . find ( function ( seEl ) { return targetElsArr . find ( function ( tgEl ) { return seEl === tgEl ; } ) ; } ) ; } else { // Fixed IE11 Array.find not defined bug targetElArr . forEach ( function ( seEl ) { return ! retEl && targetElsArr . forEach ( function ( tgEl ) { if ( ! retEl && seEl === tgEl ) { retEl = tgEl ; } } ) ; } ) ; } retEl && handler . apply ( retEl , arguments ) ; } ; /* 将包装后的方法记录到缓存中 */ addEventCache ( el , type + '_delegate_' + selector , handler , handlerWrap ) ; el . addEventListener ( type , handlerWrap , capture ) ; }