aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-01-15 21:09:32 +0000
committerScott González <scott.gonzalez@gmail.com>2010-01-15 21:09:32 +0000
commit988cdd5dbc8422f9701a10021b9b54add5ed6026 (patch)
tree8c472a1441552318611c76625bdd72763bb97752 /ui/jquery.ui.widget.js
parent003cb9d008c8d822676b4341dbecbaeb0653f45a (diff)
downloadjquery-ui-988cdd5dbc8422f9701a10021b9b54add5ed6026.tar.gz
jquery-ui-988cdd5dbc8422f9701a10021b9b54add5ed6026.zip
Widget: Make subsequent "init" calls useful by delegating to the option and _init methods.
Fixes #5064 - Widget: make multiple instantiation more useful.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index a89426347..a73df800f 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -93,7 +93,13 @@ $.widget.bridge = function( name, object ) {
});
} else {
this.each(function() {
- if ( !$.data( this, name ) ) {
+ var instance = $.data( this, name );
+ if ( instance ) {
+ if ( options ) {
+ instance.option( options );
+ }
+ instance._init();
+ } else {
$.data( this, name, new object( options, this ) );
}
});
@@ -132,13 +138,11 @@ $.Widget.prototype = {
self.destroy();
});
- if ( this._create ) {
- this._create( options, element );
- }
- if ( this._init ) {
- this._init();
- }
+ this._create( options, element );
+ this._init();
},
+ _create: function() {},
+ _init: function() {},
destroy: function() {
this.element