mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Widget: Make subsequent "init" calls useful by delegating to the option and _init methods.
Fixes #5064 - Widget: make multiple instantiation more useful.
This commit is contained in:
parent
003cb9d008
commit
988cdd5dbc
14
ui/jquery.ui.widget.js
vendored
14
ui/jquery.ui.widget.js
vendored
@ -93,7 +93,13 @@ $.widget.bridge = function( name, object ) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.each(function() {
|
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 ) );
|
$.data( this, name, new object( options, this ) );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -132,13 +138,11 @@ $.Widget.prototype = {
|
|||||||
self.destroy();
|
self.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( this._create ) {
|
|
||||||
this._create( options, element );
|
this._create( options, element );
|
||||||
}
|
|
||||||
if ( this._init ) {
|
|
||||||
this._init();
|
this._init();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
_create: function() {},
|
||||||
|
_init: function() {},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
this.element
|
this.element
|
||||||
|
Loading…
Reference in New Issue
Block a user