@@ -35,7 +35,7 @@ jQuery.event = {
3535 var fn = handler ;
3636
3737 // Create unique handler function, wrapped around original handler
38- handler = this . proxy ( fn ) ;
38+ handler = jQuery . proxy ( fn ) ;
3939
4040 // Store data in unique handler
4141 handler . data = data ;
@@ -405,24 +405,6 @@ jQuery.event = {
405405 return event ;
406406 } ,
407407
408- proxy : function ( fn , proxy , thisObject ) {
409- if ( proxy !== undefined && ! jQuery . isFunction ( proxy ) ) {
410- thisObject = proxy ;
411- proxy = undefined ;
412- }
413-
414- // FIXME: Should proxy be redefined to be applied with thisObject if defined?
415- proxy = proxy || function ( ) {
416- return fn . apply ( thisObject !== undefined ? thisObject : this , arguments ) ;
417- } ;
418-
419- // Set the guid of unique handler to the same of original handler, so it can be removed
420- proxy . guid = fn . guid = fn . guid || proxy . guid || this . guid ++ ;
421-
422- // So proxy can be declared as an argument
423- return proxy ;
424- } ,
425-
426408 special : {
427409 ready : {
428410 // Make sure the ready event is setup
@@ -474,6 +456,24 @@ jQuery.event = {
474456 }
475457} ;
476458
459+ jQuery . event . proxy = jQuery . proxy = function ( fn , proxy , thisObject ) {
460+ if ( proxy !== undefined && ! jQuery . isFunction ( proxy ) ) {
461+ thisObject = proxy ;
462+ proxy = undefined ;
463+ }
464+
465+ // FIXME: Should proxy be redefined to be applied with thisObject if defined?
466+ proxy = proxy || function ( ) {
467+ return fn . apply ( thisObject !== undefined ? thisObject : this , arguments ) ;
468+ } ;
469+
470+ // Set the guid of unique handler to the same of original handler, so it can be removed
471+ proxy . guid = fn . guid = fn . guid || proxy . guid || jQuery . event . guid ++ ;
472+
473+ // So proxy can be declared as an argument
474+ return proxy ;
475+ } ;
476+
477477jQuery . Event = function ( src ) {
478478 // Allow instantiation without the 'new' keyword
479479 if ( ! this . preventDefault ) {
@@ -759,7 +759,7 @@ if ( document.addEventListener ) {
759759}
760760
761761jQuery . each ( [ "bind" , "one" ] , function ( i , name ) {
762- jQuery . fn [ name ] = function ( type , data , fn , thisObject ) {
762+ jQuery . fn [ name ] = function ( type , data , fn ) {
763763 // Handle object literals
764764 if ( typeof type === "object" ) {
765765 for ( var key in type ) {
@@ -773,12 +773,13 @@ jQuery.each(["bind", "one"], function( i, name ) {
773773 fn = data ;
774774 data = undefined ;
775775 }
776- fn = thisObject === undefined ? fn : jQuery . event . proxy ( fn , thisObject ) ;
777- var handler = name === "one" ? jQuery . event . proxy ( fn , function ( event ) {
776+
777+ var handler = name === "one" ? jQuery . proxy ( fn , function ( event ) {
778778 jQuery ( this ) . unbind ( event , handler ) ;
779779 return fn . apply ( this , arguments ) ;
780780 } ) : fn ;
781- return type === "unload" ? this . one ( type , data , handler , thisObject ) : this . each ( function ( ) {
781+
782+ return type === "unload" ? this . one ( type , data , handler ) : this . each ( function ( ) {
782783 jQuery . event . add ( this , type , handler , data ) ;
783784 } ) ;
784785 } ;
@@ -820,10 +821,10 @@ jQuery.fn.extend({
820821
821822 // link all the functions, so any of them can unbind this click handler
822823 while ( i < args . length ) {
823- jQuery . event . proxy ( fn , args [ i ++ ] ) ;
824+ jQuery . proxy ( fn , args [ i ++ ] ) ;
824825 }
825826
826- return this . click ( jQuery . event . proxy ( fn , function ( event ) {
827+ return this . click ( jQuery . proxy ( fn , function ( event ) {
827828 // Figure out which function to execute
828829 var lastToggle = ( jQuery . data ( this , "lastToggle" + fn . guid ) || 0 ) % i ;
829830 jQuery . data ( this , "lastToggle" + fn . guid , lastToggle + 1 ) ;
@@ -840,17 +841,16 @@ jQuery.fn.extend({
840841 return this . mouseenter ( fnOver ) . mouseleave ( fnOut || fnOver ) ;
841842 } ,
842843
843- live : function ( type , data , fn , thisObject ) {
844+ live : function ( type , data , fn ) {
844845 if ( jQuery . isFunction ( data ) ) {
845- if ( fn !== undefined ) {
846- thisObject = fn ;
847- }
848846 fn = data ;
849847 data = undefined ;
850848 }
849+
851850 jQuery ( this . context ) . bind ( liveConvert ( type , this . selector ) , {
852851 data : data , selector : this . selector , live : type
853- } , fn , thisObject ) ;
852+ } , fn ) ;
853+
854854 return this ;
855855 } ,
856856
0 commit comments