- 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;