Minor documentation fixes.
[jquery.git] / src / event / event.js
index bbf52a9..583f8f5 100644 (file)
@@ -15,6 +15,13 @@ jQuery.fn.extend({
         * },function(){
         *   $(this).removeClass("selected");
         * });
+        * 
+        * @test var count = 0;
+        * var fn1 = function() { count++; }
+        * var fn2 = function() { count--; }
+        * var link = $('#mark');
+        * link.click().toggle(fn1, fn2).click().click().click().click().click();
+        * ok( count == 1, "Check for toggle(fn, fn)" );
         *
         * @name toggle
         * @type jQuery
@@ -64,7 +71,7 @@ jQuery.fn.extend({
         * @param Function over The function to fire whenever the mouse is moved over a matched element.
         * @param Function out The function to fire whenever the mouse is moved off of a matched element.
         * @cat Events
-        */\r
+        */
        hover: function(f,g) {
                
                // A private function for haandling mouse 'hovering'
@@ -1443,6 +1450,49 @@ new function(){
                 * @type jQuery
                 * @cat Events/Mouse
                 */
+                
+                /**
+                 * @test var count;
+                 * var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+                 *             "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
+                 *             "submit,keydown,keypress,keyup,error").split(",");
+                 * var handler1 = function(event) {
+                 *     count++;
+                 * };
+                 * var handler2 = function(event) {
+                 *     count++;
+                 * };
+                 * for( var i=0; i < e.length; i++) {
+                 *     var event = e[i];
+                 *     count = 0;
+                 *     // bind handler
+                 *     $(document)[event](handler1);
+                 *             $(document)[event](handler2);
+                 *     $(document)["one"+event](handler1);
+                 *     
+                 *     // call event two times
+                 *     $(document)[event]();
+                 *     $(document)[event]();
+                 *     
+                 *     // unbind events
+                 *     $(document)["un"+event](handler1);
+                 *     // call once more
+                 *     $(document)[event]();
+                 *
+                 *     // remove all handlers
+                 *             $(document)["un"+event]();
+                 *
+                 *     // call once more
+                 *     $(document)[event]();
+                 *     
+                 *     // assert count
+                 * @test ok( count == 6, 'Checking event ' + event);
+                 * }
+                 *
+                 * @private
+                 * @name eventTesting
+                 * @cat Events
+                 */
 
        var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
                "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +