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.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 7dfcb4447..ece6e9e16 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -134,18 +134,19 @@ $.Widget.prototype = {
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
- $.data( element, this.widgetName, this );
this.element = $( element );
this.options = $.extend( true, {},
this.options,
this._getCreateOptions(),
options );
-
- var self = this;
- this.element.bind( "remove." + this.widgetName, function() {
- self.destroy();
- });
-
+ if (element !== this) {
+ $.data(element, this.widgetName, this);
+
+ var self = this;
+ this.element.bind("remove." + this.widgetName, function(){
+ self.destroy();
+ });
+ }
this._create();
this._trigger( "create" );
this._init();