X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fevent.js;h=64b202d1aeb57295c89d305e08afd7a25f92fd9d;hb=b2289f3ec174c5b22d130d8c36a5e07daa6d02df;hp=3697e4e75efab100223ac98f3460f811fc96931b;hpb=61e37d41490aed319a176c6ca7feb95e5505059c;p=jquery.git diff --git a/src/event.js b/src/event.js index 3697e4e..64b202d 100644 --- a/src/event.js +++ b/src/event.js @@ -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();