X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fevent%2Fevent.js;h=55e205ae2a6edc1d244eb576eae8a60f1f9f8f6c;hb=897fbfe89c90de5f20a3eed2aeb187c625cfb43d;hp=86a93d4a7e039853d6f5dcce86226f8a3a8e5395;hpb=dbee06de85859af59591813d3004e6695b8bb278;p=jquery.git diff --git a/src/event/event.js b/src/event/event.js index 86a93d4..55e205a 100644 --- a/src/event/event.js +++ b/src/event/event.js @@ -1583,8 +1583,8 @@ new function(){ var o = e[i]; // Handle event binding - jQuery.fn[o] = function(f){ - return f ? this.bind(o, f) : this.trigger(o); + jQuery.fn[o] = function(f, amount){ + return f ? this.bind(o, f, amount) : this.trigger(o); }; // Handle event unbinding @@ -1592,20 +1592,8 @@ new function(){ // Finally, handle events that only fire once jQuery.fn["one"+o] = function(f){ - // Attach the event listener - return this.each(function(){ - - var count = 0; - - // Add the event - jQuery.event.add( this, o, function(e){ - // If this function has already been executed, stop - if ( count++ ) return; - - // And execute the bound function - return f.apply(this, [e]); - }); - }); + // use bind with amount param to bind only once + return this.bind(o, f, 1); }; };