You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
589 B
22 lines
589 B
var delegate = require('./delegate'); |
|
var isUndef = require('./isUndef'); |
|
var $safeEls = require('./$safeEls'); |
|
var each = require('./each'); |
|
exports = { |
|
on: eventFactory('add'), |
|
off: eventFactory('remove') |
|
}; |
|
function eventFactory(type) { |
|
return function(nodes, event, selector, handler) { |
|
nodes = $safeEls(nodes); |
|
if (isUndef(handler)) { |
|
handler = selector; |
|
selector = undefined; |
|
} |
|
each(nodes, function(node) { |
|
delegate[type](node, event, selector, handler); |
|
}); |
|
}; |
|
} |
|
|
|
module.exports = exports;
|
|
|