Sha256: 33e1511d530592b9d298c836afca64acc985603607dd7608565585b1dc6f3ef6

Contents?: true

Size: 857 Bytes

Versions: 80

Compression:

Stored size: 857 Bytes

Contents

/**
 * Module dependencies.
 */

var matches = require('matches-selector')
  , 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){
    if (matches(e.target, selector)) fn(e);
  }, capture);
  return callback;
};

/**
 * 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

80 entries across 80 versions & 1 rubygems

Version Path
ende-0.5.22 components/component/delegate/0.1.0/index.js
ende-0.5.21 components/component/delegate/0.1.0/index.js
ende-0.5.20 components/component/delegate/0.1.0/index.js
ende-0.5.19 components/component/delegate/0.1.0/index.js
ende-0.5.18 components/component/delegate/0.1.0/index.js
ende-0.5.17 components/component/delegate/0.1.0/index.js
ende-0.5.16 components/component/delegate/0.1.0/index.js
ende-0.5.15 components/component/delegate/0.1.0/index.js
ende-0.5.14 components/component/delegate/0.1.0/index.js
ende-0.5.13 components/component/delegate/0.1.0/index.js
ende-0.5.12 components/component/delegate/0.1.0/index.js
ende-0.5.10 components/component/delegate/0.1.0/index.js
ende-0.5.9 components/component/delegate/0.1.0/index.js
ende-0.5.8 components/component/delegate/0.1.0/index.js
ende-0.5.7 components/component/delegate/0.1.0/index.js
ende-0.5.6 components/component/delegate/0.1.0/index.js
ende-0.4.25 vendor/components/component-delegate/index.js
ende-0.5.5 components/component/delegate/0.1.0/index.js
ende-0.5.4 components/component/delegate/0.1.0/index.js
ende-0.5.3 components/component/delegate/0.1.0/index.js