delegate.js revision d408aa66c7199d6b6a133c20c2116414dc70fa0a
d408aa66c7199d6b6a133c20c2116414dc70fa0aAdam Moore(function() {
d408aa66c7199d6b6a133c20c2116414dc70fa0aAdam Moore var target = e.target, passed, spec, tests = delegates[delegateSpec], ename;
d408aa66c7199d6b6a133c20c2116414dc70fa0aAdam Moore // @TODO we need Node.some
d408aa66c7199d6b6a133c20c2116414dc70fa0aAdam Moore e.currentTarget.queryAll(spec).each(function (v, k) {
d408aa66c7199d6b6a133c20c2116414dc70fa0aAdam Moore if ((!passed) && (v.compareTo(target) || v.contains(target))) {
836a3a6b58636f23a6fefabe096fe1216b644b8bTodd Kloots * Sets up a delegated listener container.
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @event delegate
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param type {string} 'delegate'
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param fn {string} the function to execute
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param el {string|node} the element that is the delegation container
c8c3d38f7a6c444775b0daff51926e2e5f3b35a8Adam Moore * @param delegateType {string} the event type to delegate
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param spec {string} a selector that must match the target of the
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param o optional context object
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @param args 0..n additional arguments that should be provided
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * to the listener.
aadc0b0e666b9b335884a2437510798ae8949343Adam Moore * @return {Event.Handle} the detach handle
c8c3d38f7a6c444775b0daff51926e2e5f3b35a8Adam Moore on: function(type, fn, el, delegateType, spec, o) {
c8c3d38f7a6c444775b0daff51926e2e5f3b35a8Adam Moore var ename = 'delegate:' + (Y.Lang.isString(el) ? el : Y.stamp(el)) + delegateType + spec,
72190d990aacbb8af3d4e584c12bfb14e2f61536Adam Moore // set up the listener on the container
836a3a6b58636f23a6fefabe096fe1216b644b8bTodd Kloots // remove element, delegation spec and context object from the args
0bb2673f6a4a24e3d3f8952c58484f657a9f8de4Adam Moore // subscribe to the custom event for the delegation spec