]> source.dussan.org Git - jquery.git/commitdiff
Clean up in jQuery.event.add for assigning a handler.guid
authorBrandon Aaron <brandon.aaron@gmail.com>
Wed, 23 May 2007 13:51:04 +0000 (13:51 +0000)
committerBrandon Aaron <brandon.aaron@gmail.com>
Wed, 23 May 2007 13:51:04 +0000 (13:51 +0000)
src/event/event.js

index b49e1755dc2d897f747cd6397301f61ca3332914..c1dbec606e1dea5e24cf7c879edfe011bd8fecaf 100644 (file)
@@ -13,6 +13,10 @@ jQuery.event = {
                if ( jQuery.browser.msie && element.setInterval != undefined )
                        element = window;
                
+               // Make sure that the function being executed has a unique ID
+               if ( !handler.guid )
+                       handler.guid = this.guid++;
+                       
                // if data is passed, bind to handler 
                if( data != undefined ) { 
                // Create temporary function pointer to original handler 
@@ -31,13 +35,6 @@ jQuery.event = {
                        handler.guid = fn.guid;
                }
 
-               // Make sure that the function being executed has a unique ID
-               if ( !handler.guid ) {
-                       handler.guid = this.guid++;
-                       // Don't forget to set guid for the original handler function
-                       if (fn) fn.guid = handler.guid;
-               }
-
                // Init the element's event structure
                if (!element.$events)
                        element.$events = {};