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