Try to use XMLHttpRequest in more cases in IE 7. Thanks to Matt Kruse and Sam Collett...
[jquery.git] / src / event.js
index 3697e4e..64b202d 100644 (file)
@@ -230,6 +230,7 @@ jQuery.event = {
                        if ( !elem ) {
                                // Don't bubble custom events when global (to avoid too much overhead)
                                event.stopPropagation();
+
                                // Only trigger if we've ever bound an event for it
                                if ( this.global[ type ] ) {
                                        jQuery.each( jQuery.cache, function() {
@@ -426,7 +427,7 @@ jQuery.event = {
                ready: {
                        // Make sure the ready event is setup
                        setup: jQuery.bindReady,
-                       teardown: function() {}
+                       teardown: jQuery.noop
                },
 
                live: {
@@ -690,7 +691,7 @@ jQuery.event.special.change = {
                },
 
                // Change has to be called before submit
-               // Keydown will be called before keypress, wich is used in submit-event delegation
+               // Keydown will be called before keypress, which is used in submit-event delegation
                keydown: function( e ) {
                        var elem = e.target, type = elem.type;
 
@@ -777,9 +778,11 @@ jQuery.each(["bind", "one"], function( i, name ) {
                        jQuery( this ).unbind( event, handler );
                        return fn.apply( this, arguments );
                }) : fn;
-               return type === "unload" ? this.one(type, data, handler, thisObject) : this.each(function() {
-                       jQuery.event.add( this, type, handler, data );
-               });
+               return type === "unload" && name !== "one" ?
+                       this.one( type, data, fn, thisObject ) :
+                       this.each(function() {
+                               jQuery.event.add( this, type, handler, data );
+                       });
        };
 });
 
@@ -824,8 +827,8 @@ jQuery.fn.extend({
 
                return this.click( jQuery.event.proxy( fn, function( event ) {
                        // Figure out which function to execute
-                       var lastToggle = ( jQuery.data( this, 'lastToggle' + fn.guid ) || 0 ) % i;
-                       jQuery.data( this, 'lastToggle' + fn.guid, lastToggle + 1 );
+                       var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+                       jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
 
                        // Make sure that clicks stop
                        event.preventDefault();