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