|
@@ -11066,10 +11066,10 @@ define('select2/core',[
|
|
});
|
|
});
|
|
|
|
|
|
this.selection.on('open', function () {
|
|
this.selection.on('open', function () {
|
|
- self.trigger('open');
|
|
|
|
|
|
+ self.open();
|
|
});
|
|
});
|
|
this.selection.on('close', function () {
|
|
this.selection.on('close', function () {
|
|
- self.trigger('close');
|
|
|
|
|
|
+ self.close();
|
|
});
|
|
});
|
|
this.selection.on('toggle', function () {
|
|
this.selection.on('toggle', function () {
|
|
self.toggleDropdown();
|
|
self.toggleDropdown();
|
|
@@ -11088,19 +11088,19 @@ define('select2/core',[
|
|
this.selection.on('unselected', function (params) {
|
|
this.selection.on('unselected', function (params) {
|
|
self.trigger('unselect', params);
|
|
self.trigger('unselect', params);
|
|
|
|
|
|
- self.trigger('close');
|
|
|
|
|
|
+ self.close();
|
|
});
|
|
});
|
|
|
|
|
|
this.results.on('selected', function (params) {
|
|
this.results.on('selected', function (params) {
|
|
self.trigger('select', params);
|
|
self.trigger('select', params);
|
|
|
|
|
|
- self.trigger('close');
|
|
|
|
|
|
+ self.close();
|
|
});
|
|
});
|
|
|
|
|
|
this.results.on('unselected', function (params) {
|
|
this.results.on('unselected', function (params) {
|
|
self.trigger('unselect', params);
|
|
self.trigger('unselect', params);
|
|
|
|
|
|
- self.trigger('close');
|
|
|
|
|
|
+ self.close();
|
|
});
|
|
});
|
|
|
|
|
|
this.results.on('results:focus', function (params) {
|
|
this.results.on('results:focus', function (params) {
|
|
@@ -11138,16 +11138,34 @@ define('select2/core',[
|
|
|
|
|
|
$element.hide();
|
|
$element.hide();
|
|
$element.attr('tabindex', '-1');
|
|
$element.attr('tabindex', '-1');
|
|
|
|
+
|
|
|
|
+ $element.data('select2', this);
|
|
};
|
|
};
|
|
|
|
|
|
Utils.Extend(Select2, Utils.Observable);
|
|
Utils.Extend(Select2, Utils.Observable);
|
|
|
|
|
|
Select2.prototype.toggleDropdown = function () {
|
|
Select2.prototype.toggleDropdown = function () {
|
|
if (this.isOpen()) {
|
|
if (this.isOpen()) {
|
|
- this.trigger('close');
|
|
|
|
|
|
+ this.close();
|
|
} else {
|
|
} else {
|
|
- this.trigger('open');
|
|
|
|
|
|
+ this.open();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ Select2.prototype.open = function () {
|
|
|
|
+ if (this.isOpen()) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ this.trigger('open');
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ Select2.prototype.close = function () {
|
|
|
|
+ if (!this.isOpen()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.trigger('close');
|
|
};
|
|
};
|
|
|
|
|
|
Select2.prototype.isOpen = function () {
|
|
Select2.prototype.isOpen = function () {
|
|
@@ -11182,8 +11200,9 @@ define('jquery.select2',[
|
|
});
|
|
});
|
|
} else if (typeof options === 'string') {
|
|
} else if (typeof options === 'string') {
|
|
var instance = this.data('select2');
|
|
var instance = this.data('select2');
|
|
|
|
+ var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
|
|
- instance[options](arguments.slice(1));
|
|
|
|
|
|
+ instance[options](args);
|
|
} else {
|
|
} else {
|
|
throw new Error('Invalid arguments for Select2: ' + options);
|
|
throw new Error('Invalid arguments for Select2: ' + options);
|
|
}
|
|
}
|