Make sure that submit event is still bound for regular form submit events. Thanks...
[jquery.git] / src / event.js
index 7d60c27..6871327 100644 (file)
@@ -414,7 +414,7 @@ jQuery.event = {
                ready: {
                        // Make sure the ready event is setup
                        setup: jQuery.bindReady,
-                       teardown: function() {}
+                       teardown: jQuery.noop
                },
 
                live: {
@@ -604,6 +604,9 @@ jQuery.event.special.submit = {
                                        return trigger( "submit", this, arguments );
                                }
                        });
+
+               } else {
+                       return false;
                }
        },
 
@@ -752,6 +755,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
                        for ( var key in type ) {
                                this[ name ](key, data, type[key], fn);
                        }
+
                        return this;
                }
                
@@ -766,9 +770,17 @@ jQuery.each(["bind", "one"], function( i, name ) {
                        return fn.apply( this, arguments );
                }) : fn;
 
-               return type === "unload" ? this.one(type, data, handler) : this.each(function() {
-                       jQuery.event.add( this, type, handler, data );
-               });
+               if ( type === "unload" && name !== "one" ) {
+                       this.one( type, data, fn, thisObject );
+
+               } else {
+                       // Deprecated: Please don't expect an empty jQuery set to bind to document
+                       (!this.selector && !this.context ? jQuery(document) : this).each(function() {
+                               jQuery.event.add( this, type, handler, data );
+                       });
+               }
+
+               return this;
        };
 });
 
@@ -782,14 +794,20 @@ jQuery.fn.extend({
                        return this;
                }
 
-               return this.each(function() {
+               // Deprecated: Please don't expect an empty jQuery set to bind to document
+               (!this.selector && !this.context ? jQuery(document) : this).each(function() {
                        jQuery.event.remove( this, type, fn );
                });
+
+               return this;
        },
        trigger: function( type, data ) {
-               return this.each(function() {
+               // Deprecated: Please don't expect an empty jQuery set to bind to document
+               (!this.selector && !this.context ? jQuery(document) : this).each(function() {
                        jQuery.event.trigger( type, data, this );
                });
+
+               return this;
        },
 
        triggerHandler: function( type, data ) {