File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,9 +301,10 @@ $.Widget.prototype = {
301301 element = $ ( element ) ;
302302 this . bindings = this . bindings . add ( element ) ;
303303 }
304+
304305 var instance = this ;
305306 $ . each ( handlers , function ( event , handler ) {
306- element . bind ( event + "." + instance . widgetName , function ( ) {
307+ function handlerProxy ( ) {
307308 // allow widgets to customize the disabled handling
308309 // - disabled as an array instead of boolean
309310 // - disabled class as method for disabling individual parts
@@ -313,7 +314,15 @@ $.Widget.prototype = {
313314 }
314315 return ( typeof handler === "string" ? instance [ handler ] : handler )
315316 . apply ( instance , arguments ) ;
316- } ) ;
317+ }
318+ var match = key . match ( / ^ ( \w + ) \s * ( .* ) $ / ) ;
319+ var eventName = match [ 1 ] + "." + instance . widgetName ,
320+ selector = match [ 2 ] ;
321+ if ( selector === '' ) {
322+ element . bind ( eventName , handlerProxy ) ;
323+ } else {
324+ element . delegate ( selector , eventName , handlerProxy ) ;
325+ }
317326 } ) ;
318327 } ,
319328
You can’t perform that action at this time.
0 commit comments