MDL-32843 import YUI 3.5.1
[moodle.git] / lib / yui / 3.5.1 / build / event-mousewheel / event-mousewheel-debug.js
blob8a641891018c20572a090cda2349e37f9888de33
1 /*
2 YUI 3.5.1 (build 22)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 YUI.add('event-mousewheel', function(Y) {
9 /**
10  * Adds mousewheel event support
11  * @module event
12  * @submodule event-mousewheel
13  */
14 var DOM_MOUSE_SCROLL = 'DOMMouseScroll',
15     fixArgs = function(args) {
16         var a = Y.Array(args, 0, true), target;
17         if (Y.UA.gecko) {
18             a[0] = DOM_MOUSE_SCROLL;
19             target = Y.config.win;
20         } else {
21             target = Y.config.doc;
22         }
24         if (a.length < 3) {
25             a[2] = target;
26         } else {
27             a.splice(2, 0, target);
28         }
30         return a;
31     };
33 /**
34  * Mousewheel event.  This listener is automatically attached to the
35  * correct target, so one should not be supplied.  Mouse wheel 
36  * direction and velocity is stored in the 'wheelDelta' field.
37  * @event mousewheel
38  * @param type {string} 'mousewheel'
39  * @param fn {function} the callback to execute
40  * @param context optional context object
41  * @param args 0..n additional arguments to provide to the listener.
42  * @return {EventHandle} the detach handle
43  * @for YUI
44  */
45 Y.Env.evt.plugins.mousewheel = {
46     on: function() {
47         return Y.Event._attach(fixArgs(arguments));
48     },
50     detach: function() {
51         return Y.Event.detach.apply(Y.Event, fixArgs(arguments));
52     }
56 }, '3.5.1' ,{requires:['node-base']});