delegateEvents
Add delegate listeners to DOM events. Delegated listeners use a selector on an ancestor element to determine when to fire the event for an item. This can help cases where large numbers of similar DOM nodes are added into a DOM subtree, since event handlers do not have to be attached to each new node.
events
var events = require("can-util/dom/events/events");
require("can-util/dom/events/delegate/delegate");
var el = document.createElement("div");
var sub = document.createElement("div");
sub.className = "foo"
el.appendChild(sub);
function delegateEventsHandler() {
console.log("delegate event fired");
}
events.addDelegateListener.call(el, "click", ".foo", delegateEventsHandler, false);
events.removeDelegateListener.call(el, "click", ".foo", delegateEventsHandler);