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