X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=2c5445ab9917443b9bb3c3c7e132c93f1cf84902;hb=a5dbca4a06a930865a17a1d02fd88893b5a2b690;hp=944e8a9bf7ec8c06089ea4cb8a3f7175fc022cf3;hpb=3776cbe314ac6f5081e998c3d5ac84d3fbc51872;p=jquery.git diff --git a/src/core.js b/src/core.js index 944e8a9..2c5445a 100644 --- a/src/core.js +++ b/src/core.js @@ -614,6 +614,26 @@ jQuery.extend({ return ret.concat.apply( [], ret ); }, + // A global GUID counter for objects + guid: 1, + + proxy: function( fn, proxy, thisObject ) { + if ( arguments.length === 2 && proxy && !jQuery.isFunction( proxy ) ) { + thisObject = proxy; + proxy = undefined; + } + + proxy = proxy || function() { + return fn.apply( thisObject || this, arguments ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + // So proxy can be declared as an argument + return proxy; + }, + // Use of jQuery.browser is frowned upon. // More details: http://docs.jquery.com/Utilities/jQuery.browser browser: {