]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Set guid on event handler proxies so direct unbinding works.
authorScott González <scott.gonzalez@gmail.com>
Sun, 8 Jan 2012 01:48:42 +0000 (20:48 -0500)
committerScott González <scott.gonzalez@gmail.com>
Sun, 8 Jan 2012 01:48:42 +0000 (20:48 -0500)
ui/jquery.ui.widget.js

index 4f47a008b054c55eb0675a3dd105c8cea6977084..5c8560bfd33d8472f758ff7caebac5cfd919b121 100644 (file)
@@ -329,6 +329,13 @@ $.Widget.prototype = {
                                return ( typeof handler === "string" ? instance[ handler ] : handler )
                                        .apply( instance, arguments );
                        }
+
+                       // copy the guid so direct unbinding works
+                       if ( typeof handler !== "string" ) {
+                               handlerProxy.guid = handler.guid =
+                                       handler.guid || handlerProxy.guid || jQuery.guid++;
+                       }
+
                        var match = event.match( /^(\w+)\s*(.*)$/ ),
                                eventName = match[1] + "." + instance.widgetName,
                                selector = match[2];