aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-01-15 18:58:20 +0000
committerScott González <scott.gonzalez@gmail.com>2010-01-15 18:58:20 +0000
commit7d96a0d0966d9e680c968db2869900ac624a44ad (patch)
tree88076c2f23bb64749d7af87bc26991798dcff915 /ui/jquery.ui.widget.js
parentab153e07c78098567b9f1e53deb9145bcd6c22d3 (diff)
downloadjquery-ui-7d96a0d0966d9e680c968db2869900ac624a44ad.tar.gz
jquery-ui-7d96a0d0966d9e680c968db2869900ac624a44ad.zip
Widget factory: Changed _create to _init.
Partial fix for #5064 - Widget: make multiple instantiation more useful.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index e1dac2f66..4cc7fba7a 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -39,7 +39,7 @@ $.widget = function(name, base, prototype) {
$[namespace] = $[namespace] || {};
$[namespace][name] = function(options, element) {
// allow instantiation without initializing for simple inheritance
- (arguments.length && this._widgetInit(options, element));
+ (arguments.length && this._createWidget(options, element));
};
var basePrototype = new base();
@@ -99,7 +99,7 @@ $.widget.bridge = function(name, object) {
$.Widget = function(options, element) {
// allow instantiation without initializing for simple inheritance
- (arguments.length && this._widgetInit(options, element));
+ (arguments.length && this._createWidget(options, element));
};
$.Widget.prototype = {
@@ -108,9 +108,9 @@ $.Widget.prototype = {
options: {
disabled: false
},
- _widgetInit: function(options, element) {
+ _createWidget: function(options, element) {
// $.widget.bridge stores the plugin instance, but we do it anyway
- // so that it's stored even before the _init function runs
+ // so that it's stored even before the _create function runs
this.element = $(element).data(this.widgetName, this);
this.options = $.extend(true, {},
this.options,
@@ -119,13 +119,13 @@ $.Widget.prototype = {
$.metadata && $.metadata.get(element)[this.widgetName],
options);
- // TODO: use bind's scope option when moving to jQuery 1.4
var self = this;
this.element.bind('remove.' + this.widgetName, function() {
self.destroy();
});
- (this._init && this._init(options, element));
+ (this._create && this._create(options, element));
+ (this._init && this._init());
},
destroy: function() {