Skip to content

Commit

Permalink
Widget: Make subsequent "init" calls useful by delegating to the opti…
Browse files Browse the repository at this point in the history
…on and _init methods.

Fixes #5064 - Widget: make multiple instantiation more useful.
  • Loading branch information
scottgonzalez committed Jan 15, 2010
1 parent 003cb9d commit 988cdd5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ui/jquery.ui.widget.js
Expand Up @@ -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 ) );
}
});
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 988cdd5

Please sign in to comment.