aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-29 14:00:00 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-29 14:00:00 +0200
commit982b752c3507f8e8512ca02f365a2d854d65a5cc (patch)
treed5ca7624fa6d3bd99120538fd7ab235ce41fad99 /ui/jquery.ui.widget.js
parent61caba7803d1c3885a8e2a6cd3c1e8b723e8beee (diff)
parent0ff3396e8853d1858db56e4ad7552f87c09e5504 (diff)
downloadjquery-ui-982b752c3507f8e8512ca02f365a2d854d65a5cc.tar.gz
jquery-ui-982b752c3507f8e8512ca02f365a2d854d65a5cc.zip
Merge branch 'widget-delegation'
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 59d110b6a..a66b8a54a 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -305,9 +305,10 @@ $.Widget.prototype = {
element = $( element );
this.bindings = this.bindings.add( element );
}
+
var instance = this;
$.each( handlers, function( event, handler ) {
- element.bind( event + "." + instance.widgetName, function() {
+ function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
@@ -317,7 +318,15 @@ $.Widget.prototype = {
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
- });
+ }
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
+ eventName = match[1] + "." + instance.widgetName,
+ selector = match[2];
+ if ( selector ) {
+ element.delegate( selector, eventName, handlerProxy );
+ } else {
+ element.bind( eventName, handlerProxy );
+ }
});
},