event-delegate-debug.js revision a3f0309be08e898a3389129368861c7d1d286374
/**
* Adds event delegation support to the library.
*
* @module event
* @submodule event-delegate
*/
delegates = {},
specialTypes = {
mouseenter: "mouseover",
mouseleave: "mouseout"
},
focusMethods = {
},
resolveTextNode = function(n) {
try {
if (n && 3 == n.nodeType) {
return n.parentNode;
}
} catch(e) { }
return n;
},
spec,
fn,
ev;
var returnVal;
returnVal = false;
}
else {
}
return returnVal;
};
matched = null;
}
// The target is a descendant of an element matching
// the selector, so crawl up to find the ancestor that
// matches the selector
}
if (matched) {
if (!ev) {
}
contextFn: function() {
return ev.currentTarget;
}
});
if (fn) {
}
else {
}
}
}
}
},
function (e) {
},
element];
if (attachFn) {
}
else {
}
},
});
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied selector to test if the target or one of the
* descendants of the target match it. The supplied callback function
* will only be executed if a match was encountered, and, in fact,
* will be executed for each element that matches if you supply an
* ambiguous selector.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the delegation specifcation. 'container' is
* set to the element that the listener is bound to (this normally would
* be the 'currentTarget').
*
* @event delegate
* @param type {string} 'delegate'
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param delegateType {string} the event type to delegate
* @param spec {string} a selector that must match the target of the
* event.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
* @deprecated use Y.delegate
*/
}
};
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied selector to test if the target or one of the
* descendants of the target match it. The supplied callback function
* will only be executed if a match was encountered, and, in fact,
* will be executed for each element that matches if you supply an
* ambiguous selector.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the delegation specifcation. 'container' is
* set to the element that the listener is bound to (this normally would
* be the 'currentTarget').
*
* @method delegate
* @param type {string} the event type to delegate
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param spec {string} a selector that must match the target of the
* event.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
if (!spec) {
return false;
}
// identifier to target the container
// the custom event for the delegation spec
// the key to the listener for the event type and container
if (!delegate) {
delegate = {};
if (specialTypes[type]) {
if (!Event._fireMouseEnter) {
Y.log("Delegating a " + type + " event requires the event-mouseenter submodule.", "error", "Event");
return false;
}
}
// Create the DOM Event wrapper that will fire the custom event
});
}
else {
}
// el_map[guid] = el_map[guid] || {};
// el_map[guid][key] = delgate;
}
// remove element, delegation spec
// subscribe to the custom event for the delegation spec
};