Merged the three unbind docs into one, added a few more (optional) hints; Use one...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 4 Jan 2007 09:47:42 +0000 (09:47 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 4 Jan 2007 09:47:42 +0000 (09:47 +0000)
src/event/event.js
src/fx/fx.js

index ac69480..eaf6858 100644 (file)
@@ -265,43 +265,31 @@ jQuery.fn.extend({
 
        /**
         * The opposite of bind, removes a bound event from each of the matched
-        * elements. You must pass the identical function that was used in the original
-        * bind method.
+        * elements.
         *
-        * @example $("p").unbind( "click", function() { alert("Hello"); } )
+        * Without any arguments, all bound events are removed.
+        *
+        * If the type is provided, all bound events of that type are removed.
+        *
+        * If the function that was passed to bind is provided as the second argument,
+        * only that specific event handler is removed.
+        *
+        * @example $("p").unbind()
         * @before <p onclick="alert('Hello');">Hello</p>
         * @result [ <p>Hello</p> ]
         *
-        * @name unbind
-        * @type jQuery
-        * @param String type An event type
-        * @param Function fn A function to unbind from the event on each of the set of matched elements
-        * @cat Events
-        */
-
-       /**
-        * Removes all bound events of a particular type from each of the matched
-        * elements.
-        *
         * @example $("p").unbind( "click" )
         * @before <p onclick="alert('Hello');">Hello</p>
         * @result [ <p>Hello</p> ]
         *
-        * @name unbind
-        * @type jQuery
-        * @param String type An event type
-        * @cat Events
-        */
-
-       /**
-        * Removes all bound events from each of the matched elements.
-        *
-        * @example $("p").unbind()
+        * @example $("p").unbind( "click", function() { alert("Hello"); } )
         * @before <p onclick="alert('Hello');">Hello</p>
         * @result [ <p>Hello</p> ]
         *
         * @name unbind
         * @type jQuery
+        * @param String type (optional) An event type
+        * @param Function fn (optional) A function to unbind from the event on each of the set of matched elements
         * @cat Events
         */
        unbind: function( type, fn ) {
@@ -1090,7 +1078,7 @@ new function(){
 
 // Clean up after IE to avoid memory leaks
 if (jQuery.browser.msie)
-       jQuery(window).bind("unload", function() {
+       jQuery(window).one("unload", function() {
                var global = jQuery.event.global;
                for ( var type in global ) {
                        var els = global[type], i = els.length;
index 4f81aca..dd72c65 100644 (file)
@@ -73,7 +73,7 @@ jQuery.fn.extend({
         *\r
         * @name slideDown\r
         * @type jQuery\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
         * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         * @see slideUp(String|Number,Function)\r
@@ -98,7 +98,7 @@ jQuery.fn.extend({
         *\r
         * @name slideUp\r
         * @type jQuery\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
         * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         * @see slideDown(String|Number,Function)\r
@@ -123,13 +123,13 @@ jQuery.fn.extend({
         *\r
         * @name slideToggle\r
         * @type jQuery\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
         * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         * @see slideDown(String|Number,Function)\r
         * @see slideUp(String|Number,Function)\r
         */\r
-       slideToggle: function(speed,callback){\r
+       slideToggle: function(speed, callback){\r
                return this.each(function(){\r
                        var state = jQuery(this).is(":hidden") ? "show" : "hide";\r
                        jQuery(this).animate({height: state}, speed, callback);\r
@@ -152,13 +152,13 @@ jQuery.fn.extend({
         *\r
         * @name fadeIn\r
         * @type jQuery\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
         * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         * @see fadeOut(String|Number,Function)\r
         * @see fadeTo(String|Number,Number,Function)\r
         */\r
-       fadeIn: function(speed,callback){\r
+       fadeIn: function(speed, callback){\r
                return this.animate({opacity: "show"}, speed, callback);\r
        },\r
        \r
@@ -178,13 +178,13 @@ jQuery.fn.extend({
         *\r
         * @name fadeOut\r
         * @type jQuery\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
         * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         * @see fadeIn(String|Number,Function)\r
         * @see fadeTo(String|Number,Number,Function)\r
         */\r
-       fadeOut: function(speed,callback){\r
+       fadeOut: function(speed, callback){\r
                return this.animate({opacity: "hide"}, speed, callback);\r
        },\r
        \r
@@ -238,8 +238,8 @@ jQuery.fn.extend({
         * @name animate\r
         * @type jQuery\r
         * @param Hash params A set of style attributes that you wish to animate, and to what end.\r
-        * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
-        * @param Function callback A function to be executed whenever the animation completes.\r
+        * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).\r
+        * @param Function callback (optional) A function to be executed whenever the animation completes.\r
         * @cat Effects/Animations\r
         */\r
        animate: function(prop,speed,callback) {\r