Sha256: 5f881d0aa3bc172b94e30dca23e8e36e328005e14156d7031ef00a87fbcbabed
Contents?: true
Size: 929 Bytes
Versions: 27
Compression:
Stored size: 929 Bytes
Contents
/** * Module dependencies. */ var closest = require('closest') , event = require('event'); /** * Delegate event `type` to `selector` * and invoke `fn(e)`. A callback function * is returned which may be passed to `.unbind()`. * * @param {Element} el * @param {String} selector * @param {String} type * @param {Function} fn * @param {Boolean} capture * @return {Function} * @api public */ exports.bind = function(el, selector, type, fn, capture){ return event.bind(el, type, function(e){ var target = e.target || e.srcElement; e.delegateTarget = closest(target, selector, true, el); if (e.delegateTarget) fn.call(el, e); }, capture); }; /** * Unbind event `type`'s callback `fn`. * * @param {Element} el * @param {String} type * @param {Function} fn * @param {Boolean} capture * @api public */ exports.unbind = function(el, type, fn, capture){ event.unbind(el, type, fn, capture); };
Version data entries
27 entries across 14 versions & 1 rubygems