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