]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - jssource/src_files/include/javascript/yui3/build/node/node-event-delegate.js
Release 6.2.0beta4
[Github/sugarcrm.git] / jssource / src_files / include / javascript / yui3 / build / node / node-event-delegate.js
1 /*
2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.net/yui/license.txt
5 version: 3.0.0
6 build: 1549
7 */
8 YUI.add('node-event-delegate', function(Y) {
9
10 /**
11  * Functionality to make the node a delegated event container
12  * @module node
13  * @submodule node-event-delegate
14  */
15
16 /**
17  * Functionality to make the node a delegated event container
18  * @method delegate
19  * @param type {String} the event type to delegate
20  * @param fn {Function} the function to execute
21  * @param selector {String} a selector that must match the target of the event.
22  * @return {Event.Handle} the detach handle
23  * @for Node
24  */
25 Y.Node.prototype.delegate = function(type, fn, selector) {
26
27     var args = Array.prototype.slice.call(arguments, 3),
28         a = [type, fn, Y.Node.getDOMNode(this), selector];
29     a = a.concat(args);
30
31     return Y.delegate.apply(Y, a);
32 };
33
34
35 }, '3.0.0' ,{requires:['node-base', 'event-delegate', 'pluginhost']});