aboutsummaryrefslogtreecommitdiffstats
path: root/src/event
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-04 09:47:42 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2007-01-04 09:47:42 +0000
commitdf91317ab43254bb0095482c49de080f5cf4f89e (patch)
tree95065bee3c4e633c9a0470ce0694ee2f089876f9 /src/event
parente0c7e6aec4cf55854217d5c0b2c7069ce84a3d12 (diff)
downloadjquery-df91317ab43254bb0095482c49de080f5cf4f89e.tar.gz
jquery-df91317ab43254bb0095482c49de080f5cf4f89e.zip
Merged the three unbind docs into one, added a few more (optional) hints; Use one() instead of bind() for unload
Diffstat (limited to 'src/event')
-rw-r--r--src/event/event.js38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/event/event.js b/src/event/event.js
index ac6948046..eaf6858c5 100644
--- a/src/event/event.js
+++ b/src/event/event.js
@@ -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;