aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 59c362838..4d786e5c6 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -129,6 +129,8 @@ $.Widget.prototype = {
this._getCreateOptions(),
options );
+ this.bindings = $();
+
var self = this;
this.element.bind( "remove." + this.widgetName, function() {
self.destroy();
@@ -162,6 +164,7 @@ $.Widget.prototype = {
.removeClass(
this.widgetBaseClass + "-disabled " +
"ui-state-disabled" );
+ this.bindings.unbind( "." + this.widgetName );
},
_destroy: $.noop,
@@ -216,6 +219,25 @@ $.Widget.prototype = {
return this._setOption( "disabled", true );
},
+ _bind: function( element, handlers ) {
+ // no element argument, shuffle and use this.element
+ if ( !handlers ) {
+ handlers = element;
+ element = this.element;
+ } else {
+ this.bindings = this.bindings.add( element );
+ }
+ var instance = this;
+ $.each( handlers, function( event, handler ) {
+ element.bind( event + "." + instance.widgetName, function() {
+ if ( instance.options.disabled ) {
+ return;
+ }
+ return handler.apply( instance, arguments );
+ });
+ });
+ },
+
_trigger: function( type, event, data ) {
var callback = this.options[ type ];