Fix for #474
[jquery.git] / src / event / event.js
1 jQuery.fn.extend({
2
3         // We're overriding the old toggle function, so
4         // remember it for later
5         _toggle: jQuery.fn.toggle,
6         
7         /**
8          * Toggle between two function calls every other click.
9          * Whenever a matched element is clicked, the first specified function 
10          * is fired, when clicked again, the second is fired. All subsequent 
11          * clicks continue to rotate through the two functions.
12          *
13          * @example $("p").toggle(function(){
14          *   $(this).addClass("selected");
15          * },function(){
16          *   $(this).removeClass("selected");
17          * });
18          * 
19          * @name toggle
20          * @type jQuery
21          * @param Function even The function to execute on every even click.
22          * @param Function odd The function to execute on every odd click.
23          * @cat Events
24          */
25         toggle: function(a,b) {
26                 // If two functions are passed in, we're
27                 // toggling on a click
28                 return a && b && a.constructor == Function && b.constructor == Function ? this.click(function(e){
29                         // Figure out which function to execute
30                         this.last = this.last == a ? b : a;
31                         
32                         // Make sure that clicks stop
33                         e.preventDefault();
34                         
35                         // and execute the function
36                         return this.last.apply( this, [e] ) || false;
37                 }) :
38                 
39                 // Otherwise, execute the old toggle function
40                 this._toggle.apply( this, arguments );
41         },
42         
43         /**
44          * A method for simulating hovering (moving the mouse on, and off,
45          * an object). This is a custom method which provides an 'in' to a 
46          * frequent task.
47          *
48          * Whenever the mouse cursor is moved over a matched 
49          * element, the first specified function is fired. Whenever the mouse 
50          * moves off of the element, the second specified function fires. 
51          * Additionally, checks are in place to see if the mouse is still within 
52          * the specified element itself (for example, an image inside of a div), 
53          * and if it is, it will continue to 'hover', and not move out 
54          * (a common error in using a mouseout event handler).
55          *
56          * @example $("p").hover(function(){
57          *   $(this).addClass("over");
58          * },function(){
59          *   $(this).addClass("out");
60          * });
61          *
62          * @name hover
63          * @type jQuery
64          * @param Function over The function to fire whenever the mouse is moved over a matched element.
65          * @param Function out The function to fire whenever the mouse is moved off of a matched element.
66          * @cat Events
67          */
68         hover: function(f,g) {
69                 
70                 // A private function for haandling mouse 'hovering'
71                 function handleHover(e) {
72                         // Check if mouse(over|out) are still within the same parent element
73                         var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
74         
75                         // Traverse up the tree
76                         while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
77                         
78                         // If we actually just moused on to a sub-element, ignore it
79                         if ( p == this ) return false;
80                         
81                         // Execute the right function
82                         return (e.type == "mouseover" ? f : g).apply(this, [e]);
83                 }
84                 
85                 // Bind the function to the two event listeners
86                 return this.mouseover(handleHover).mouseout(handleHover);
87         },
88         
89         /**
90          * Bind a function to be executed whenever the DOM is ready to be
91          * traversed and manipulated. This is probably the most important 
92          * function included in the event module, as it can greatly improve
93          * the response times of your web applications.
94          *
95          * In a nutshell, this is a solid replacement for using window.onload, 
96          * and attaching a function to that. By using this method, your bound Function 
97          * will be called the instant the DOM is ready to be read and manipulated, 
98          * which is exactly what 99.99% of all Javascript code needs to run.
99          * 
100          * Please ensure you have no code in your <body> onload event handler, 
101          * otherwise $(document).ready() may not fire.
102          *
103          * You can have as many $(document).ready events on your page as you like.
104          *
105          * @example $(document).ready(function(){ Your code here... });
106          *
107          * @name ready
108          * @type jQuery
109          * @param Function fn The function to be executed when the DOM is ready.
110          * @cat Events
111          */
112         ready: function(f) {
113                 // If the DOM is already ready
114                 if ( jQuery.isReady )
115                         // Execute the function immediately
116                         f.apply( document );
117                         
118                 // Otherwise, remember the function for later
119                 else {
120                         // Add the function to the wait list
121                         jQuery.readyList.push( f );
122                 }
123         
124                 return this;
125         }
126 });
127
128 jQuery.extend({
129         /*
130          * All the code that makes DOM Ready work nicely.
131          */
132         isReady: false,
133         readyList: [],
134         
135         // Handle when the DOM is ready
136         ready: function() {
137                 // Make sure that the DOM is not already loaded
138                 if ( !jQuery.isReady ) {
139                         // Remember that the DOM is ready
140                         jQuery.isReady = true;
141                         
142                         // If there are functions bound, to execute
143                         if ( jQuery.readyList ) {
144                                 // Execute all of them
145                                 for ( var i = 0; i < jQuery.readyList.length; i++ )
146                                         jQuery.readyList[i].apply( document );
147                                 
148                                 // Reset the list of functions
149                                 jQuery.readyList = null;
150                         }
151                         // Remove event lisenter to avoid memory leak
152                         if ( jQuery.browser.mozilla || jQuery.browser.opera )
153                                 document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
154                 }
155         }
156 });
157
158 new function(){
159
160                 /**
161                  * Bind a function to the scroll event of each matched element.
162                  *
163                  * @example $("p").scroll( function() { alert("Hello"); } );
164                  * @before <p>Hello</p>
165                  * @result <p onscroll="alert('Hello');">Hello</p>
166                  *
167                  * @name scroll
168                  * @type jQuery
169                  * @param Function fn A function to bind to the scroll event on each of the matched elements.
170                  * @cat Events/Browser
171                  */
172
173                 /**
174                  * Trigger the scroll event of each matched element. This causes all of the functions
175                  * that have been bound to thet scroll event to be executed.
176                  *
177                  * @example $("p").scroll();
178                  * @before <p onscroll="alert('Hello');">Hello</p>
179                  * @result alert('Hello');
180                  *
181                  * @name scroll
182                  * @type jQuery
183                  * @cat Events/Browser
184                  */
185
186                 /**
187                  * Bind a function to the scroll event of each matched element, which will only be executed once.
188                  * Unlike a call to the normal .scroll() method, calling .onescroll() causes the bound function to be
189                  * only executed the first time it is triggered, and never again (unless it is re-bound).
190                  *
191                  * @example $("p").onescroll( function() { alert("Hello"); } );
192                  * @before <p onscroll="alert('Hello');">Hello</p>
193                  * @result alert('Hello'); // Only executed for the first scroll
194                  *
195                  * @name onescroll
196                  * @type jQuery
197                  * @param Function fn A function to bind to the scroll event on each of the matched elements.
198                  * @cat Events/Browser
199                  */
200
201                 /**
202                  * Removes a bound scroll event from each of the matched
203                  * elements. You must pass the identical function that was used in the original 
204                  * bind method.
205                  *
206                  * @example $("p").unscroll( myFunction );
207                  * @before <p onscroll="myFunction">Hello</p>
208                  * @result <p>Hello</p>
209                  *
210                  * @name unscroll
211                  * @type jQuery
212                  * @param Function fn A function to unbind from the scroll event on each of the matched elements.
213                  * @cat Events/Browser
214                  */
215
216                 /**
217                  * Removes all bound scroll events from each of the matched elements.
218                  *
219                  * @example $("p").unscroll();
220                  * @before <p onscroll="alert('Hello');">Hello</p>
221                  * @result <p>Hello</p>
222                  *
223                  * @name unscroll
224                  * @type jQuery
225                  * @cat Events/Browser
226                  */
227
228                 /**
229                  * Bind a function to the submit event of each matched element.
230                  *
231                  * @example $("p").submit( function() { alert("Hello"); } );
232                  * @before <p>Hello</p>
233                  * @result <p onsubmit="alert('Hello');">Hello</p>
234                  *
235                  * @name submit
236                  * @type jQuery
237                  * @param Function fn A function to bind to the submit event on each of the matched elements.
238                  * @cat Events/Form
239                  */
240
241                 /**
242                  * Trigger the submit event of each matched element. This causes all of the functions
243                  * that have been bound to thet submit event to be executed.
244                  *
245                  * @example $("p").submit();
246                  * @before <p onsubmit="alert('Hello');">Hello</p>
247                  * @result alert('Hello');
248                  *
249                  * @name submit
250                  * @type jQuery
251                  * @cat Events/Form
252                  */
253
254                 /**
255                  * Bind a function to the submit event of each matched element, which will only be executed once.
256                  * Unlike a call to the normal .submit() method, calling .onesubmit() causes the bound function to be
257                  * only executed the first time it is triggered, and never again (unless it is re-bound).
258                  *
259                  * @example $("p").onesubmit( function() { alert("Hello"); } );
260                  * @before <p onsubmit="alert('Hello');">Hello</p>
261                  * @result alert('Hello'); // Only executed for the first submit
262                  *
263                  * @name onesubmit
264                  * @type jQuery
265                  * @param Function fn A function to bind to the submit event on each of the matched elements.
266                  * @cat Events/Form
267                  */
268
269                 /**
270                  * Removes a bound submit event from each of the matched
271                  * elements. You must pass the identical function that was used in the original 
272                  * bind method.
273                  *
274                  * @example $("p").unsubmit( myFunction );
275                  * @before <p onsubmit="myFunction">Hello</p>
276                  * @result <p>Hello</p>
277                  *
278                  * @name unsubmit
279                  * @type jQuery
280                  * @param Function fn A function to unbind from the submit event on each of the matched elements.
281                  * @cat Events/Form
282                  */
283
284                 /**
285                  * Removes all bound submit events from each of the matched elements.
286                  *
287                  * @example $("p").unsubmit();
288                  * @before <p onsubmit="alert('Hello');">Hello</p>
289                  * @result <p>Hello</p>
290                  *
291                  * @name unsubmit
292                  * @type jQuery
293                  * @cat Events/Form
294                  */
295
296                 /**
297                  * Bind a function to the focus event of each matched element.
298                  *
299                  * @example $("p").focus( function() { alert("Hello"); } );
300                  * @before <p>Hello</p>
301                  * @result <p onfocus="alert('Hello');">Hello</p>
302                  *
303                  * @name focus
304                  * @type jQuery
305                  * @param Function fn A function to bind to the focus event on each of the matched elements.
306                  * @cat Events/UI
307                  */
308
309                 /**
310                  * Trigger the focus event of each matched element. This causes all of the functions
311                  * that have been bound to thet focus event to be executed.
312                  *
313                  * @example $("p").focus();
314                  * @before <p onfocus="alert('Hello');">Hello</p>
315                  * @result alert('Hello');
316                  *
317                  * @name focus
318                  * @type jQuery
319                  * @cat Events/UI
320                  */
321
322                 /**
323                  * Bind a function to the focus event of each matched element, which will only be executed once.
324                  * Unlike a call to the normal .focus() method, calling .onefocus() causes the bound function to be
325                  * only executed the first time it is triggered, and never again (unless it is re-bound).
326                  *
327                  * @example $("p").onefocus( function() { alert("Hello"); } );
328                  * @before <p onfocus="alert('Hello');">Hello</p>
329                  * @result alert('Hello'); // Only executed for the first focus
330                  *
331                  * @name onefocus
332                  * @type jQuery
333                  * @param Function fn A function to bind to the focus event on each of the matched elements.
334                  * @cat Events/UI
335                  */
336
337                 /**
338                  * Removes a bound focus event from each of the matched
339                  * elements. You must pass the identical function that was used in the original 
340                  * bind method.
341                  *
342                  * @example $("p").unfocus( myFunction );
343                  * @before <p onfocus="myFunction">Hello</p>
344                  * @result <p>Hello</p>
345                  *
346                  * @name unfocus
347                  * @type jQuery
348                  * @param Function fn A function to unbind from the focus event on each of the matched elements.
349                  * @cat Events/UI
350                  */
351
352                 /**
353                  * Removes all bound focus events from each of the matched elements.
354                  *
355                  * @example $("p").unfocus();
356                  * @before <p onfocus="alert('Hello');">Hello</p>
357                  * @result <p>Hello</p>
358                  *
359                  * @name unfocus
360                  * @type jQuery
361                  * @cat Events/UI
362                  */
363
364                 /**
365                  * Bind a function to the keydown event of each matched element.
366                  *
367                  * @example $("p").keydown( function() { alert("Hello"); } );
368                  * @before <p>Hello</p>
369                  * @result <p onkeydown="alert('Hello');">Hello</p>
370                  *
371                  * @name keydown
372                  * @type jQuery
373                  * @param Function fn A function to bind to the keydown event on each of the matched elements.
374                  * @cat Events/Keyboard
375                  */
376
377                 /**
378                  * Trigger the keydown event of each matched element. This causes all of the functions
379                  * that have been bound to thet keydown event to be executed.
380                  *
381                  * @example $("p").keydown();
382                  * @before <p onkeydown="alert('Hello');">Hello</p>
383                  * @result alert('Hello');
384                  *
385                  * @name keydown
386                  * @type jQuery
387                  * @cat Events/Keyboard
388                  */
389
390                 /**
391                  * Bind a function to the keydown event of each matched element, which will only be executed once.
392                  * Unlike a call to the normal .keydown() method, calling .onekeydown() causes the bound function to be
393                  * only executed the first time it is triggered, and never again (unless it is re-bound).
394                  *
395                  * @example $("p").onekeydown( function() { alert("Hello"); } );
396                  * @before <p onkeydown="alert('Hello');">Hello</p>
397                  * @result alert('Hello'); // Only executed for the first keydown
398                  *
399                  * @name onekeydown
400                  * @type jQuery
401                  * @param Function fn A function to bind to the keydown event on each of the matched elements.
402                  * @cat Events/Keyboard
403                  */
404
405                 /**
406                  * Removes a bound keydown event from each of the matched
407                  * elements. You must pass the identical function that was used in the original 
408                  * bind method.
409                  *
410                  * @example $("p").unkeydown( myFunction );
411                  * @before <p onkeydown="myFunction">Hello</p>
412                  * @result <p>Hello</p>
413                  *
414                  * @name unkeydown
415                  * @type jQuery
416                  * @param Function fn A function to unbind from the keydown event on each of the matched elements.
417                  * @cat Events/Keyboard
418                  */
419
420                 /**
421                  * Removes all bound keydown events from each of the matched elements.
422                  *
423                  * @example $("p").unkeydown();
424                  * @before <p onkeydown="alert('Hello');">Hello</p>
425                  * @result <p>Hello</p>
426                  *
427                  * @name unkeydown
428                  * @type jQuery
429                  * @cat Events/Keyboard
430                  */
431
432                 /**
433                  * Bind a function to the dblclick event of each matched element.
434                  *
435                  * @example $("p").dblclick( function() { alert("Hello"); } );
436                  * @before <p>Hello</p>
437                  * @result <p ondblclick="alert('Hello');">Hello</p>
438                  *
439                  * @name dblclick
440                  * @type jQuery
441                  * @param Function fn A function to bind to the dblclick event on each of the matched elements.
442                  * @cat Events/Mouse
443                  */
444
445                 /**
446                  * Trigger the dblclick event of each matched element. This causes all of the functions
447                  * that have been bound to thet dblclick event to be executed.
448                  *
449                  * @example $("p").dblclick();
450                  * @before <p ondblclick="alert('Hello');">Hello</p>
451                  * @result alert('Hello');
452                  *
453                  * @name dblclick
454                  * @type jQuery
455                  * @cat Events/Mouse
456                  */
457
458                 /**
459                  * Bind a function to the dblclick event of each matched element, which will only be executed once.
460                  * Unlike a call to the normal .dblclick() method, calling .onedblclick() causes the bound function to be
461                  * only executed the first time it is triggered, and never again (unless it is re-bound).
462                  *
463                  * @example $("p").onedblclick( function() { alert("Hello"); } );
464                  * @before <p ondblclick="alert('Hello');">Hello</p>
465                  * @result alert('Hello'); // Only executed for the first dblclick
466                  *
467                  * @name onedblclick
468                  * @type jQuery
469                  * @param Function fn A function to bind to the dblclick event on each of the matched elements.
470                  * @cat Events/Mouse
471                  */
472
473                 /**
474                  * Removes a bound dblclick event from each of the matched
475                  * elements. You must pass the identical function that was used in the original 
476                  * bind method.
477                  *
478                  * @example $("p").undblclick( myFunction );
479                  * @before <p ondblclick="myFunction">Hello</p>
480                  * @result <p>Hello</p>
481                  *
482                  * @name undblclick
483                  * @type jQuery
484                  * @param Function fn A function to unbind from the dblclick event on each of the matched elements.
485                  * @cat Events/Mouse
486                  */
487
488                 /**
489                  * Removes all bound dblclick events from each of the matched elements.
490                  *
491                  * @example $("p").undblclick();
492                  * @before <p ondblclick="alert('Hello');">Hello</p>
493                  * @result <p>Hello</p>
494                  *
495                  * @name undblclick
496                  * @type jQuery
497                  * @cat Events/Mouse
498                  */
499
500                 /**
501                  * Bind a function to the keypress event of each matched element.
502                  *
503                  * @example $("p").keypress( function() { alert("Hello"); } );
504                  * @before <p>Hello</p>
505                  * @result <p onkeypress="alert('Hello');">Hello</p>
506                  *
507                  * @name keypress
508                  * @type jQuery
509                  * @param Function fn A function to bind to the keypress event on each of the matched elements.
510                  * @cat Events/Keyboard
511                  */
512
513                 /**
514                  * Trigger the keypress event of each matched element. This causes all of the functions
515                  * that have been bound to thet keypress event to be executed.
516                  *
517                  * @example $("p").keypress();
518                  * @before <p onkeypress="alert('Hello');">Hello</p>
519                  * @result alert('Hello');
520                  *
521                  * @name keypress
522                  * @type jQuery
523                  * @cat Events/Keyboard
524                  */
525
526                 /**
527                  * Bind a function to the keypress event of each matched element, which will only be executed once.
528                  * Unlike a call to the normal .keypress() method, calling .onekeypress() causes the bound function to be
529                  * only executed the first time it is triggered, and never again (unless it is re-bound).
530                  *
531                  * @example $("p").onekeypress( function() { alert("Hello"); } );
532                  * @before <p onkeypress="alert('Hello');">Hello</p>
533                  * @result alert('Hello'); // Only executed for the first keypress
534                  *
535                  * @name onekeypress
536                  * @type jQuery
537                  * @param Function fn A function to bind to the keypress event on each of the matched elements.
538                  * @cat Events/Keyboard
539                  */
540
541                 /**
542                  * Removes a bound keypress event from each of the matched
543                  * elements. You must pass the identical function that was used in the original 
544                  * bind method.
545                  *
546                  * @example $("p").unkeypress( myFunction );
547                  * @before <p onkeypress="myFunction">Hello</p>
548                  * @result <p>Hello</p>
549                  *
550                  * @name unkeypress
551                  * @type jQuery
552                  * @param Function fn A function to unbind from the keypress event on each of the matched elements.
553                  * @cat Events/Keyboard
554                  */
555
556                 /**
557                  * Removes all bound keypress events from each of the matched elements.
558                  *
559                  * @example $("p").unkeypress();
560                  * @before <p onkeypress="alert('Hello');">Hello</p>
561                  * @result <p>Hello</p>
562                  *
563                  * @name unkeypress
564                  * @type jQuery
565                  * @cat Events/Keyboard
566                  */
567
568                 /**
569                  * Bind a function to the error event of each matched element.
570                  *
571                  * @example $("p").error( function() { alert("Hello"); } );
572                  * @before <p>Hello</p>
573                  * @result <p onerror="alert('Hello');">Hello</p>
574                  *
575                  * @name error
576                  * @type jQuery
577                  * @param Function fn A function to bind to the error event on each of the matched elements.
578                  * @cat Events/Browser
579                  */
580
581                 /**
582                  * Trigger the error event of each matched element. This causes all of the functions
583                  * that have been bound to thet error event to be executed.
584                  *
585                  * @example $("p").error();
586                  * @before <p onerror="alert('Hello');">Hello</p>
587                  * @result alert('Hello');
588                  *
589                  * @name error
590                  * @type jQuery
591                  * @cat Events/Browser
592                  */
593
594                 /**
595                  * Bind a function to the error event of each matched element, which will only be executed once.
596                  * Unlike a call to the normal .error() method, calling .oneerror() causes the bound function to be
597                  * only executed the first time it is triggered, and never again (unless it is re-bound).
598                  *
599                  * @example $("p").oneerror( function() { alert("Hello"); } );
600                  * @before <p onerror="alert('Hello');">Hello</p>
601                  * @result alert('Hello'); // Only executed for the first error
602                  *
603                  * @name oneerror
604                  * @type jQuery
605                  * @param Function fn A function to bind to the error event on each of the matched elements.
606                  * @cat Events/Browser
607                  */
608
609                 /**
610                  * Removes a bound error event from each of the matched
611                  * elements. You must pass the identical function that was used in the original 
612                  * bind method.
613                  *
614                  * @example $("p").unerror( myFunction );
615                  * @before <p onerror="myFunction">Hello</p>
616                  * @result <p>Hello</p>
617                  *
618                  * @name unerror
619                  * @type jQuery
620                  * @param Function fn A function to unbind from the error event on each of the matched elements.
621                  * @cat Events/Browser
622                  */
623
624                 /**
625                  * Removes all bound error events from each of the matched elements.
626                  *
627                  * @example $("p").unerror();
628                  * @before <p onerror="alert('Hello');">Hello</p>
629                  * @result <p>Hello</p>
630                  *
631                  * @name unerror
632                  * @type jQuery
633                  * @cat Events/Browser
634                  */
635
636                 /**
637                  * Bind a function to the blur event of each matched element.
638                  *
639                  * @example $("p").blur( function() { alert("Hello"); } );
640                  * @before <p>Hello</p>
641                  * @result <p onblur="alert('Hello');">Hello</p>
642                  *
643                  * @name blur
644                  * @type jQuery
645                  * @param Function fn A function to bind to the blur event on each of the matched elements.
646                  * @cat Events/UI
647                  */
648
649                 /**
650                  * Trigger the blur event of each matched element. This causes all of the functions
651                  * that have been bound to thet blur event to be executed.
652                  *
653                  * @example $("p").blur();
654                  * @before <p onblur="alert('Hello');">Hello</p>
655                  * @result alert('Hello');
656                  *
657                  * @name blur
658                  * @type jQuery
659                  * @cat Events/UI
660                  */
661
662                 /**
663                  * Bind a function to the blur event of each matched element, which will only be executed once.
664                  * Unlike a call to the normal .blur() method, calling .oneblur() causes the bound function to be
665                  * only executed the first time it is triggered, and never again (unless it is re-bound).
666                  *
667                  * @example $("p").oneblur( function() { alert("Hello"); } );
668                  * @before <p onblur="alert('Hello');">Hello</p>
669                  * @result alert('Hello'); // Only executed for the first blur
670                  *
671                  * @name oneblur
672                  * @type jQuery
673                  * @param Function fn A function to bind to the blur event on each of the matched elements.
674                  * @cat Events/UI
675                  */
676
677                 /**
678                  * Removes a bound blur event from each of the matched
679                  * elements. You must pass the identical function that was used in the original 
680                  * bind method.
681                  *
682                  * @example $("p").unblur( myFunction );
683                  * @before <p onblur="myFunction">Hello</p>
684                  * @result <p>Hello</p>
685                  *
686                  * @name unblur
687                  * @type jQuery
688                  * @param Function fn A function to unbind from the blur event on each of the matched elements.
689                  * @cat Events/UI
690                  */
691
692                 /**
693                  * Removes all bound blur events from each of the matched elements.
694                  *
695                  * @example $("p").unblur();
696                  * @before <p onblur="alert('Hello');">Hello</p>
697                  * @result <p>Hello</p>
698                  *
699                  * @name unblur
700                  * @type jQuery
701                  * @cat Events/UI
702                  */
703
704                 /**
705                  * Bind a function to the load event of each matched element.
706                  *
707                  * @example $("p").load( function() { alert("Hello"); } );
708                  * @before <p>Hello</p>
709                  * @result <p onload="alert('Hello');">Hello</p>
710                  *
711                  * @name load
712                  * @type jQuery
713                  * @param Function fn A function to bind to the load event on each of the matched elements.
714                  * @cat Events/Browser
715                  */
716
717                 /**
718                  * Trigger the load event of each matched element. This causes all of the functions
719                  * that have been bound to thet load event to be executed.
720                  *
721                  * Marked as private: Calling load() without arguments throws exception because the ajax load
722                  * does not handle it.
723                  *
724                  * @example $("p").load();
725                  * @before <p onload="alert('Hello');">Hello</p>
726                  * @result alert('Hello');
727                  *
728                  * @name load
729                  * @private
730                  * @type jQuery
731                  * @cat Events/Browser
732                  */
733
734                 /**
735                  * Bind a function to the load event of each matched element, which will only be executed once.
736                  * Unlike a call to the normal .load() method, calling .oneload() causes the bound function to be
737                  * only executed the first time it is triggered, and never again (unless it is re-bound).
738                  *
739                  * @example $("p").oneload( function() { alert("Hello"); } );
740                  * @before <p onload="alert('Hello');">Hello</p>
741                  * @result alert('Hello'); // Only executed for the first load
742                  *
743                  * @name oneload
744                  * @type jQuery
745                  * @param Function fn A function to bind to the load event on each of the matched elements.
746                  * @cat Events/Browser
747                  */
748
749                 /**
750                  * Removes a bound load event from each of the matched
751                  * elements. You must pass the identical function that was used in the original 
752                  * bind method.
753                  *
754                  * @example $("p").unload( myFunction );
755                  * @before <p onload="myFunction">Hello</p>
756                  * @result <p>Hello</p>
757                  *
758                  * @name unload
759                  * @type jQuery
760                  * @param Function fn A function to unbind from the load event on each of the matched elements.
761                  * @cat Events/Browser
762                  */
763
764                 /**
765                  * Removes all bound load events from each of the matched elements.
766                  *
767                  * @example $("p").unload();
768                  * @before <p onload="alert('Hello');">Hello</p>
769                  * @result <p>Hello</p>
770                  *
771                  * @name unload
772                  * @type jQuery
773                  * @cat Events/Browser
774                  */
775
776                 /**
777                  * Bind a function to the select event of each matched element.
778                  *
779                  * @example $("p").select( function() { alert("Hello"); } );
780                  * @before <p>Hello</p>
781                  * @result <p onselect="alert('Hello');">Hello</p>
782                  *
783                  * @name select
784                  * @type jQuery
785                  * @param Function fn A function to bind to the select event on each of the matched elements.
786                  * @cat Events/Form
787                  */
788
789                 /**
790                  * Trigger the select event of each matched element. This causes all of the functions
791                  * that have been bound to thet select event to be executed.
792                  *
793                  * @example $("p").select();
794                  * @before <p onselect="alert('Hello');">Hello</p>
795                  * @result alert('Hello');
796                  *
797                  * @name select
798                  * @type jQuery
799                  * @cat Events/Form
800                  */
801
802                 /**
803                  * Bind a function to the select event of each matched element, which will only be executed once.
804                  * Unlike a call to the normal .select() method, calling .oneselect() causes the bound function to be
805                  * only executed the first time it is triggered, and never again (unless it is re-bound).
806                  *
807                  * @example $("p").oneselect( function() { alert("Hello"); } );
808                  * @before <p onselect="alert('Hello');">Hello</p>
809                  * @result alert('Hello'); // Only executed for the first select
810                  *
811                  * @name oneselect
812                  * @type jQuery
813                  * @param Function fn A function to bind to the select event on each of the matched elements.
814                  * @cat Events/Form
815                  */
816
817                 /**
818                  * Removes a bound select event from each of the matched
819                  * elements. You must pass the identical function that was used in the original 
820                  * bind method.
821                  *
822                  * @example $("p").unselect( myFunction );
823                  * @before <p onselect="myFunction">Hello</p>
824                  * @result <p>Hello</p>
825                  *
826                  * @name unselect
827                  * @type jQuery
828                  * @param Function fn A function to unbind from the select event on each of the matched elements.
829                  * @cat Events/Form
830                  */
831
832                 /**
833                  * Removes all bound select events from each of the matched elements.
834                  *
835                  * @example $("p").unselect();
836                  * @before <p onselect="alert('Hello');">Hello</p>
837                  * @result <p>Hello</p>
838                  *
839                  * @name unselect
840                  * @type jQuery
841                  * @cat Events/Form
842                  */
843
844                 /**
845                  * Bind a function to the mouseup event of each matched element.
846                  *
847                  * @example $("p").mouseup( function() { alert("Hello"); } );
848                  * @before <p>Hello</p>
849                  * @result <p onmouseup="alert('Hello');">Hello</p>
850                  *
851                  * @name mouseup
852                  * @type jQuery
853                  * @param Function fn A function to bind to the mouseup event on each of the matched elements.
854                  * @cat Events/Mouse
855                  */
856
857                 /**
858                  * Trigger the mouseup event of each matched element. This causes all of the functions
859                  * that have been bound to thet mouseup event to be executed.
860                  *
861                  * @example $("p").mouseup();
862                  * @before <p onmouseup="alert('Hello');">Hello</p>
863                  * @result alert('Hello');
864                  *
865                  * @name mouseup
866                  * @type jQuery
867                  * @cat Events/Mouse
868                  */
869
870                 /**
871                  * Bind a function to the mouseup event of each matched element, which will only be executed once.
872                  * Unlike a call to the normal .mouseup() method, calling .onemouseup() causes the bound function to be
873                  * only executed the first time it is triggered, and never again (unless it is re-bound).
874                  *
875                  * @example $("p").onemouseup( function() { alert("Hello"); } );
876                  * @before <p onmouseup="alert('Hello');">Hello</p>
877                  * @result alert('Hello'); // Only executed for the first mouseup
878                  *
879                  * @name onemouseup
880                  * @type jQuery
881                  * @param Function fn A function to bind to the mouseup event on each of the matched elements.
882                  * @cat Events/Mouse
883                  */
884
885                 /**
886                  * Removes a bound mouseup event from each of the matched
887                  * elements. You must pass the identical function that was used in the original 
888                  * bind method.
889                  *
890                  * @example $("p").unmouseup( myFunction );
891                  * @before <p onmouseup="myFunction">Hello</p>
892                  * @result <p>Hello</p>
893                  *
894                  * @name unmouseup
895                  * @type jQuery
896                  * @param Function fn A function to unbind from the mouseup event on each of the matched elements.
897                  * @cat Events/Mouse
898                  */
899
900                 /**
901                  * Removes all bound mouseup events from each of the matched elements.
902                  *
903                  * @example $("p").unmouseup();
904                  * @before <p onmouseup="alert('Hello');">Hello</p>
905                  * @result <p>Hello</p>
906                  *
907                  * @name unmouseup
908                  * @type jQuery
909                  * @cat Events/Mouse
910                  */
911
912                 /**
913                  * Bind a function to the unload event of each matched element.
914                  *
915                  * @example $("p").unload( function() { alert("Hello"); } );
916                  * @before <p>Hello</p>
917                  * @result <p onunload="alert('Hello');">Hello</p>
918                  *
919                  * @name unload
920                  * @type jQuery
921                  * @param Function fn A function to bind to the unload event on each of the matched elements.
922                  * @cat Events/Browser
923                  */
924
925                 /**
926                  * Trigger the unload event of each matched element. This causes all of the functions
927                  * that have been bound to thet unload event to be executed.
928                  *
929                  * @example $("p").unload();
930                  * @before <p onunload="alert('Hello');">Hello</p>
931                  * @result alert('Hello');
932                  *
933                  * @name unload
934                  * @type jQuery
935                  * @cat Events/Browser
936                  */
937
938                 /**
939                  * Bind a function to the unload event of each matched element, which will only be executed once.
940                  * Unlike a call to the normal .unload() method, calling .oneunload() causes the bound function to be
941                  * only executed the first time it is triggered, and never again (unless it is re-bound).
942                  *
943                  * @example $("p").oneunload( function() { alert("Hello"); } );
944                  * @before <p onunload="alert('Hello');">Hello</p>
945                  * @result alert('Hello'); // Only executed for the first unload
946                  *
947                  * @name oneunload
948                  * @type jQuery
949                  * @param Function fn A function to bind to the unload event on each of the matched elements.
950                  * @cat Events/Browser
951                  */
952
953                 /**
954                  * Removes a bound unload event from each of the matched
955                  * elements. You must pass the identical function that was used in the original 
956                  * bind method.
957                  *
958                  * @example $("p").ununload( myFunction );
959                  * @before <p onunload="myFunction">Hello</p>
960                  * @result <p>Hello</p>
961                  *
962                  * @name ununload
963                  * @type jQuery
964                  * @param Function fn A function to unbind from the unload event on each of the matched elements.
965                  * @cat Events/Browser
966                  */
967
968                 /**
969                  * Removes all bound unload events from each of the matched elements.
970                  *
971                  * @example $("p").ununload();
972                  * @before <p onunload="alert('Hello');">Hello</p>
973                  * @result <p>Hello</p>
974                  *
975                  * @name ununload
976                  * @type jQuery
977                  * @cat Events/Browser
978                  */
979
980                 /**
981                  * Bind a function to the change event of each matched element.
982                  *
983                  * @example $("p").change( function() { alert("Hello"); } );
984                  * @before <p>Hello</p>
985                  * @result <p onchange="alert('Hello');">Hello</p>
986                  *
987                  * @name change
988                  * @type jQuery
989                  * @param Function fn A function to bind to the change event on each of the matched elements.
990                  * @cat Events/Form
991                  */
992
993                 /**
994                  * Trigger the change event of each matched element. This causes all of the functions
995                  * that have been bound to thet change event to be executed.
996                  *
997                  * @example $("p").change();
998                  * @before <p onchange="alert('Hello');">Hello</p>
999                  * @result alert('Hello');
1000                  *
1001                  * @name change
1002                  * @type jQuery
1003                  * @cat Events/Form
1004                  */
1005
1006                 /**
1007                  * Bind a function to the change event of each matched element, which will only be executed once.
1008                  * Unlike a call to the normal .change() method, calling .onechange() causes the bound function to be
1009                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1010                  *
1011                  * @example $("p").onechange( function() { alert("Hello"); } );
1012                  * @before <p onchange="alert('Hello');">Hello</p>
1013                  * @result alert('Hello'); // Only executed for the first change
1014                  *
1015                  * @name onechange
1016                  * @type jQuery
1017                  * @param Function fn A function to bind to the change event on each of the matched elements.
1018                  * @cat Events/Form
1019                  */
1020
1021                 /**
1022                  * Removes a bound change event from each of the matched
1023                  * elements. You must pass the identical function that was used in the original 
1024                  * bind method.
1025                  *
1026                  * @example $("p").unchange( myFunction );
1027                  * @before <p onchange="myFunction">Hello</p>
1028                  * @result <p>Hello</p>
1029                  *
1030                  * @name unchange
1031                  * @type jQuery
1032                  * @param Function fn A function to unbind from the change event on each of the matched elements.
1033                  * @cat Events/Form
1034                  */
1035
1036                 /**
1037                  * Removes all bound change events from each of the matched elements.
1038                  *
1039                  * @example $("p").unchange();
1040                  * @before <p onchange="alert('Hello');">Hello</p>
1041                  * @result <p>Hello</p>
1042                  *
1043                  * @name unchange
1044                  * @type jQuery
1045                  * @cat Events/Form
1046                  */
1047
1048                 /**
1049                  * Bind a function to the mouseout event of each matched element.
1050                  *
1051                  * @example $("p").mouseout( function() { alert("Hello"); } );
1052                  * @before <p>Hello</p>
1053                  * @result <p onmouseout="alert('Hello');">Hello</p>
1054                  *
1055                  * @name mouseout
1056                  * @type jQuery
1057                  * @param Function fn A function to bind to the mouseout event on each of the matched elements.
1058                  * @cat Events/Mouse
1059                  */
1060
1061                 /**
1062                  * Trigger the mouseout event of each matched element. This causes all of the functions
1063                  * that have been bound to thet mouseout event to be executed.
1064                  *
1065                  * @example $("p").mouseout();
1066                  * @before <p onmouseout="alert('Hello');">Hello</p>
1067                  * @result alert('Hello');
1068                  *
1069                  * @name mouseout
1070                  * @type jQuery
1071                  * @cat Events/Mouse
1072                  */
1073
1074                 /**
1075                  * Bind a function to the mouseout event of each matched element, which will only be executed once.
1076                  * Unlike a call to the normal .mouseout() method, calling .onemouseout() causes the bound function to be
1077                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1078                  *
1079                  * @example $("p").onemouseout( function() { alert("Hello"); } );
1080                  * @before <p onmouseout="alert('Hello');">Hello</p>
1081                  * @result alert('Hello'); // Only executed for the first mouseout
1082                  *
1083                  * @name onemouseout
1084                  * @type jQuery
1085                  * @param Function fn A function to bind to the mouseout event on each of the matched elements.
1086                  * @cat Events/Mouse
1087                  */
1088
1089                 /**
1090                  * Removes a bound mouseout event from each of the matched
1091                  * elements. You must pass the identical function that was used in the original 
1092                  * bind method.
1093                  *
1094                  * @example $("p").unmouseout( myFunction );
1095                  * @before <p onmouseout="myFunction">Hello</p>
1096                  * @result <p>Hello</p>
1097                  *
1098                  * @name unmouseout
1099                  * @type jQuery
1100                  * @param Function fn A function to unbind from the mouseout event on each of the matched elements.
1101                  * @cat Events/Mouse
1102                  */
1103
1104                 /**
1105                  * Removes all bound mouseout events from each of the matched elements.
1106                  *
1107                  * @example $("p").unmouseout();
1108                  * @before <p onmouseout="alert('Hello');">Hello</p>
1109                  * @result <p>Hello</p>
1110                  *
1111                  * @name unmouseout
1112                  * @type jQuery
1113                  * @cat Events/Mouse
1114                  */
1115
1116                 /**
1117                  * Bind a function to the keyup event of each matched element.
1118                  *
1119                  * @example $("p").keyup( function() { alert("Hello"); } );
1120                  * @before <p>Hello</p>
1121                  * @result <p onkeyup="alert('Hello');">Hello</p>
1122                  *
1123                  * @name keyup
1124                  * @type jQuery
1125                  * @param Function fn A function to bind to the keyup event on each of the matched elements.
1126                  * @cat Events/Keyboard
1127                  */
1128
1129                 /**
1130                  * Trigger the keyup event of each matched element. This causes all of the functions
1131                  * that have been bound to thet keyup event to be executed.
1132                  *
1133                  * @example $("p").keyup();
1134                  * @before <p onkeyup="alert('Hello');">Hello</p>
1135                  * @result alert('Hello');
1136                  *
1137                  * @name keyup
1138                  * @type jQuery
1139                  * @cat Events/Keyboard
1140                  */
1141
1142                 /**
1143                  * Bind a function to the keyup event of each matched element, which will only be executed once.
1144                  * Unlike a call to the normal .keyup() method, calling .onekeyup() causes the bound function to be
1145                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1146                  *
1147                  * @example $("p").onekeyup( function() { alert("Hello"); } );
1148                  * @before <p onkeyup="alert('Hello');">Hello</p>
1149                  * @result alert('Hello'); // Only executed for the first keyup
1150                  *
1151                  * @name onekeyup
1152                  * @type jQuery
1153                  * @param Function fn A function to bind to the keyup event on each of the matched elements.
1154                  * @cat Events/Keyboard
1155                  */
1156
1157                 /**
1158                  * Removes a bound keyup event from each of the matched
1159                  * elements. You must pass the identical function that was used in the original 
1160                  * bind method.
1161                  *
1162                  * @example $("p").unkeyup( myFunction );
1163                  * @before <p onkeyup="myFunction">Hello</p>
1164                  * @result <p>Hello</p>
1165                  *
1166                  * @name unkeyup
1167                  * @type jQuery
1168                  * @param Function fn A function to unbind from the keyup event on each of the matched elements.
1169                  * @cat Events/Keyboard
1170                  */
1171
1172                 /**
1173                  * Removes all bound keyup events from each of the matched elements.
1174                  *
1175                  * @example $("p").unkeyup();
1176                  * @before <p onkeyup="alert('Hello');">Hello</p>
1177                  * @result <p>Hello</p>
1178                  *
1179                  * @name unkeyup
1180                  * @type jQuery
1181                  * @cat Events/Keyboard
1182                  */
1183
1184                 /**
1185                  * Bind a function to the click event of each matched element.
1186                  *
1187                  * @example $("p").click( function() { alert("Hello"); } );
1188                  * @before <p>Hello</p>
1189                  * @result <p onclick="alert('Hello');">Hello</p>
1190                  *
1191                  * @name click
1192                  * @type jQuery
1193                  * @param Function fn A function to bind to the click event on each of the matched elements.
1194                  * @cat Events/Mouse
1195                  */
1196
1197                 /**
1198                  * Trigger the click event of each matched element. This causes all of the functions
1199                  * that have been bound to thet click event to be executed.
1200                  *
1201                  * @example $("p").click();
1202                  * @before <p onclick="alert('Hello');">Hello</p>
1203                  * @result alert('Hello');
1204                  *
1205                  * @name click
1206                  * @type jQuery
1207                  * @cat Events/Mouse
1208                  */
1209
1210                 /**
1211                  * Bind a function to the click event of each matched element, which will only be executed once.
1212                  * Unlike a call to the normal .click() method, calling .oneclick() causes the bound function to be
1213                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1214                  *
1215                  * @example $("p").oneclick( function() { alert("Hello"); } );
1216                  * @before <p onclick="alert('Hello');">Hello</p>
1217                  * @result alert('Hello'); // Only executed for the first click
1218                  *
1219                  * @name oneclick
1220                  * @type jQuery
1221                  * @param Function fn A function to bind to the click event on each of the matched elements.
1222                  * @cat Events/Mouse
1223                  */
1224
1225                 /**
1226                  * Removes a bound click event from each of the matched
1227                  * elements. You must pass the identical function that was used in the original 
1228                  * bind method.
1229                  *
1230                  * @example $("p").unclick( myFunction );
1231                  * @before <p onclick="myFunction">Hello</p>
1232                  * @result <p>Hello</p>
1233                  *
1234                  * @name unclick
1235                  * @type jQuery
1236                  * @param Function fn A function to unbind from the click event on each of the matched elements.
1237                  * @cat Events/Mouse
1238                  */
1239
1240                 /**
1241                  * Removes all bound click events from each of the matched elements.
1242                  *
1243                  * @example $("p").unclick();
1244                  * @before <p onclick="alert('Hello');">Hello</p>
1245                  * @result <p>Hello</p>
1246                  *
1247                  * @name unclick
1248                  * @type jQuery
1249                  * @cat Events/Mouse
1250                  */
1251
1252                 /**
1253                  * Bind a function to the resize event of each matched element.
1254                  *
1255                  * @example $("p").resize( function() { alert("Hello"); } );
1256                  * @before <p>Hello</p>
1257                  * @result <p onresize="alert('Hello');">Hello</p>
1258                  *
1259                  * @name resize
1260                  * @type jQuery
1261                  * @param Function fn A function to bind to the resize event on each of the matched elements.
1262                  * @cat Events/Browser
1263                  */
1264
1265                 /**
1266                  * Trigger the resize event of each matched element. This causes all of the functions
1267                  * that have been bound to thet resize event to be executed.
1268                  *
1269                  * @example $("p").resize();
1270                  * @before <p onresize="alert('Hello');">Hello</p>
1271                  * @result alert('Hello');
1272                  *
1273                  * @name resize
1274                  * @type jQuery
1275                  * @cat Events/Browser
1276                  */
1277
1278                 /**
1279                  * Bind a function to the resize event of each matched element, which will only be executed once.
1280                  * Unlike a call to the normal .resize() method, calling .oneresize() causes the bound function to be
1281                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1282                  *
1283                  * @example $("p").oneresize( function() { alert("Hello"); } );
1284                  * @before <p onresize="alert('Hello');">Hello</p>
1285                  * @result alert('Hello'); // Only executed for the first resize
1286                  *
1287                  * @name oneresize
1288                  * @type jQuery
1289                  * @param Function fn A function to bind to the resize event on each of the matched elements.
1290                  * @cat Events/Browser
1291                  */
1292
1293                 /**
1294                  * Removes a bound resize event from each of the matched
1295                  * elements. You must pass the identical function that was used in the original 
1296                  * bind method.
1297                  *
1298                  * @example $("p").unresize( myFunction );
1299                  * @before <p onresize="myFunction">Hello</p>
1300                  * @result <p>Hello</p>
1301                  *
1302                  * @name unresize
1303                  * @type jQuery
1304                  * @param Function fn A function to unbind from the resize event on each of the matched elements.
1305                  * @cat Events/Browser
1306                  */
1307
1308                 /**
1309                  * Removes all bound resize events from each of the matched elements.
1310                  *
1311                  * @example $("p").unresize();
1312                  * @before <p onresize="alert('Hello');">Hello</p>
1313                  * @result <p>Hello</p>
1314                  *
1315                  * @name unresize
1316                  * @type jQuery
1317                  * @cat Events/Browser
1318                  */
1319
1320                 /**
1321                  * Bind a function to the mousemove event of each matched element.
1322                  *
1323                  * @example $("p").mousemove( function() { alert("Hello"); } );
1324                  * @before <p>Hello</p>
1325                  * @result <p onmousemove="alert('Hello');">Hello</p>
1326                  *
1327                  * @name mousemove
1328                  * @type jQuery
1329                  * @param Function fn A function to bind to the mousemove event on each of the matched elements.
1330                  * @cat Events/Mouse
1331                  */
1332
1333                 /**
1334                  * Trigger the mousemove event of each matched element. This causes all of the functions
1335                  * that have been bound to thet mousemove event to be executed.
1336                  *
1337                  * @example $("p").mousemove();
1338                  * @before <p onmousemove="alert('Hello');">Hello</p>
1339                  * @result alert('Hello');
1340                  *
1341                  * @name mousemove
1342                  * @type jQuery
1343                  * @cat Events/Mouse
1344                  */
1345
1346                 /**
1347                  * Bind a function to the mousemove event of each matched element, which will only be executed once.
1348                  * Unlike a call to the normal .mousemove() method, calling .onemousemove() causes the bound function to be
1349                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1350                  *
1351                  * @example $("p").onemousemove( function() { alert("Hello"); } );
1352                  * @before <p onmousemove="alert('Hello');">Hello</p>
1353                  * @result alert('Hello'); // Only executed for the first mousemove
1354                  *
1355                  * @name onemousemove
1356                  * @type jQuery
1357                  * @param Function fn A function to bind to the mousemove event on each of the matched elements.
1358                  * @cat Events/Mouse
1359                  */
1360
1361                 /**
1362                  * Removes a bound mousemove event from each of the matched
1363                  * elements. You must pass the identical function that was used in the original 
1364                  * bind method.
1365                  *
1366                  * @example $("p").unmousemove( myFunction );
1367                  * @before <p onmousemove="myFunction">Hello</p>
1368                  * @result <p>Hello</p>
1369                  *
1370                  * @name unmousemove
1371                  * @type jQuery
1372                  * @param Function fn A function to unbind from the mousemove event on each of the matched elements.
1373                  * @cat Events/Mouse
1374                  */
1375
1376                 /**
1377                  * Removes all bound mousemove events from each of the matched elements.
1378                  *
1379                  * @example $("p").unmousemove();
1380                  * @before <p onmousemove="alert('Hello');">Hello</p>
1381                  * @result <p>Hello</p>
1382                  *
1383                  * @name unmousemove
1384                  * @type jQuery
1385                  * @cat Events/Mouse
1386                  */
1387
1388                 /**
1389                  * Bind a function to the mousedown event of each matched element.
1390                  *
1391                  * @example $("p").mousedown( function() { alert("Hello"); } );
1392                  * @before <p>Hello</p>
1393                  * @result <p onmousedown="alert('Hello');">Hello</p>
1394                  *
1395                  * @name mousedown
1396                  * @type jQuery
1397                  * @param Function fn A function to bind to the mousedown event on each of the matched elements.
1398                  * @cat Events/Mouse
1399                  */
1400
1401                 /**
1402                  * Trigger the mousedown event of each matched element. This causes all of the functions
1403                  * that have been bound to thet mousedown event to be executed.
1404                  *
1405                  * @example $("p").mousedown();
1406                  * @before <p onmousedown="alert('Hello');">Hello</p>
1407                  * @result alert('Hello');
1408                  *
1409                  * @name mousedown
1410                  * @type jQuery
1411                  * @cat Events/Mouse
1412                  */
1413
1414                 /**
1415                  * Bind a function to the mousedown event of each matched element, which will only be executed once.
1416                  * Unlike a call to the normal .mousedown() method, calling .onemousedown() causes the bound function to be
1417                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1418                  *
1419                  * @example $("p").onemousedown( function() { alert("Hello"); } );
1420                  * @before <p onmousedown="alert('Hello');">Hello</p>
1421                  * @result alert('Hello'); // Only executed for the first mousedown
1422                  *
1423                  * @name onemousedown
1424                  * @type jQuery
1425                  * @param Function fn A function to bind to the mousedown event on each of the matched elements.
1426                  * @cat Events/Mouse
1427                  */
1428
1429                 /**
1430                  * Removes a bound mousedown event from each of the matched
1431                  * elements. You must pass the identical function that was used in the original 
1432                  * bind method.
1433                  *
1434                  * @example $("p").unmousedown( myFunction );
1435                  * @before <p onmousedown="myFunction">Hello</p>
1436                  * @result <p>Hello</p>
1437                  *
1438                  * @name unmousedown
1439                  * @type jQuery
1440                  * @param Function fn A function to unbind from the mousedown event on each of the matched elements.
1441                  * @cat Events/Mouse
1442                  */
1443
1444                 /**
1445                  * Removes all bound mousedown events from each of the matched elements.
1446                  *
1447                  * @example $("p").unmousedown();
1448                  * @before <p onmousedown="alert('Hello');">Hello</p>
1449                  * @result <p>Hello</p>
1450                  *
1451                  * @name unmousedown
1452                  * @type jQuery
1453                  * @cat Events/Mouse
1454                  */
1455                  
1456                 /**
1457                  * Bind a function to the mouseover event of each matched element.
1458                  *
1459                  * @example $("p").mouseover( function() { alert("Hello"); } );
1460                  * @before <p>Hello</p>
1461                  * @result <p onmouseover="alert('Hello');">Hello</p>
1462                  *
1463                  * @name mouseover
1464                  * @type jQuery
1465                  * @param Function fn A function to bind to the mousedown event on each of the matched elements.
1466                  * @cat Events/Mouse
1467                  */
1468
1469                 /**
1470                  * Trigger the mouseover event of each matched element. This causes all of the functions
1471                  * that have been bound to thet mousedown event to be executed.
1472                  *
1473                  * @example $("p").mouseover();
1474                  * @before <p onmouseover="alert('Hello');">Hello</p>
1475                  * @result alert('Hello');
1476                  *
1477                  * @name mouseover
1478                  * @type jQuery
1479                  * @cat Events/Mouse
1480                  */
1481
1482                 /**
1483                  * Bind a function to the mouseover event of each matched element, which will only be executed once.
1484                  * Unlike a call to the normal .mouseover() method, calling .onemouseover() causes the bound function to be
1485                  * only executed the first time it is triggered, and never again (unless it is re-bound).
1486                  *
1487                  * @example $("p").onemouseover( function() { alert("Hello"); } );
1488                  * @before <p onmouseover="alert('Hello');">Hello</p>
1489                  * @result alert('Hello'); // Only executed for the first mouseover
1490                  *
1491                  * @name onemouseover
1492                  * @type jQuery
1493                  * @param Function fn A function to bind to the mouseover event on each of the matched elements.
1494                  * @cat Events/Mouse
1495                  */
1496
1497                 /**
1498                  * Removes a bound mouseover event from each of the matched
1499                  * elements. You must pass the identical function that was used in the original 
1500                  * bind method.
1501                  *
1502                  * @example $("p").unmouseover( myFunction );
1503                  * @before <p onmouseover="myFunction">Hello</p>
1504                  * @result <p>Hello</p>
1505                  *
1506                  * @name unmouseover
1507                  * @type jQuery
1508                  * @param Function fn A function to unbind from the mouseover event on each of the matched elements.
1509                  * @cat Events/Mouse
1510                  */
1511
1512                 /**
1513                  * Removes all bound mouseover events from each of the matched elements.
1514                  *
1515                  * @example $("p").unmouseover();
1516                  * @before <p onmouseover="alert('Hello');">Hello</p>
1517                  * @result <p>Hello</p>
1518                  *
1519                  * @name unmouseover
1520                  * @type jQuery
1521                  * @cat Events/Mouse
1522                  */
1523
1524         var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
1525                 "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
1526                 "submit,keydown,keypress,keyup,error").split(",");
1527
1528         // Go through all the event names, but make sure that
1529         // it is enclosed properly
1530         for ( var i = 0; i < e.length; i++ ) new function(){
1531                         
1532                 var o = e[i];
1533                 
1534                 // Handle event binding
1535                 jQuery.fn[o] = function(f){
1536                         return f ? this.bind(o, f) : this.trigger(o);
1537                 };
1538                 
1539                 // Handle event unbinding
1540                 jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
1541                 
1542                 // Finally, handle events that only fire once
1543                 jQuery.fn["one"+o] = function(f){
1544                         // save cloned reference to this
1545                         var element = jQuery(this);
1546                         var handler = function() {
1547                                 // unbind itself when executed
1548                                 element.unbind(o, handler);
1549                                 element = null;
1550                                 // apply original handler with the same arguments
1551                                 return f.apply(this, arguments);
1552                         };
1553                         return this.bind(o, handler);
1554                 };
1555                         
1556         };
1557         
1558         // If Mozilla is used
1559         if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
1560                 // Use the handy event callback
1561                 document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
1562         
1563         // If IE is used, use the excellent hack by Matthias Miller
1564         // http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
1565         } else if ( jQuery.browser.msie ) {
1566         
1567                 // Only works if you document.write() it
1568                 document.write("<scr" + "ipt id=__ie_init defer=true " + 
1569                         "src=//:><\/script>");
1570         
1571                 // Use the defer script hack
1572                 var script = document.getElementById("__ie_init");
1573                 if (script) // script does not exist if jQuery is loaded dynamically
1574                         script.onreadystatechange = function() {
1575                                 if ( this.readyState != "complete" ) return;
1576                                 this.parentNode.removeChild( this );
1577                                 jQuery.ready();
1578                         };
1579         
1580                 // Clear from memory
1581                 script = null;
1582         
1583         // If Safari  is used
1584         } else if ( jQuery.browser.safari ) {
1585                 // Continually check to see if the document.readyState is valid
1586                 jQuery.safariTimer = setInterval(function(){
1587                         // loaded and complete are both valid states
1588                         if ( document.readyState == "loaded" || 
1589                                 document.readyState == "complete" ) {
1590         
1591                                 // If either one are found, remove the timer
1592                                 clearInterval( jQuery.safariTimer );
1593                                 jQuery.safariTimer = null;
1594         
1595                                 // and execute any waiting functions
1596                                 jQuery.ready();
1597                         }
1598                 }, 10);
1599         } 
1600
1601         // A fallback to window.onload, that will always work
1602         jQuery.event.add( window, "load", jQuery.ready );
1603         
1604 };
1605
1606 // Clean up after IE to avoid memory leaks
1607 if (jQuery.browser.msie) jQuery(window).unload(function() {
1608         var event = jQuery.event, global = event.global;
1609         for (var type in global) {
1610                 var els = global[type], i = els.length;
1611                 if (i>0) do if (type != 'unload') event.remove(els[i-1], type); while (--i);
1612         }
1613 });