Widget: Set guid on event handler proxies so direct unbinding works.

This commit is contained in:
Scott González 2012-01-07 20:48:42 -05:00
parent 31ebe7e7da
commit 3cf98e5ca1

View File

@ -329,6 +329,13 @@ $.Widget.prototype = {
return ( typeof handler === "string" ? instance[ handler ] : handler ) return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments ); .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*(.*)$/ ), var match = event.match( /^(\w+)\s*(.*)$/ ),
eventName = match[1] + "." + instance.widgetName, eventName = match[1] + "." + instance.widgetName,
selector = match[2]; selector = match[2];