|
@@ -1,11 +1,11 @@
|
|
|
/*!
|
|
|
- * Select2 4.0.5
|
|
|
+ * Select2 4.0.6-rc.0
|
|
|
* https://select2.github.io
|
|
|
*
|
|
|
* Released under the MIT license
|
|
|
* https://github.com/select2/select2/blob/master/LICENSE.md
|
|
|
*/
|
|
|
-(function (factory) {
|
|
|
+;(function (factory) {
|
|
|
if (typeof define === 'function' && define.amd) {
|
|
|
// AMD. Register as an anonymous module.
|
|
|
define(['jquery'], factory);
|
|
@@ -574,10 +574,10 @@ S2.define('select2/utils',[
|
|
|
DecoratedClass.prototype = new ctr();
|
|
|
|
|
|
for (var m = 0; m < superMethods.length; m++) {
|
|
|
- var superMethod = superMethods[m];
|
|
|
+ var superMethod = superMethods[m];
|
|
|
|
|
|
- DecoratedClass.prototype[superMethod] =
|
|
|
- SuperClass.prototype[superMethod];
|
|
|
+ DecoratedClass.prototype[superMethod] =
|
|
|
+ SuperClass.prototype[superMethod];
|
|
|
}
|
|
|
|
|
|
var calledMethod = function (methodName) {
|
|
@@ -772,6 +772,67 @@ S2.define('select2/utils',[
|
|
|
$element.append($nodes);
|
|
|
};
|
|
|
|
|
|
+ // Cache objects in Utils.__cache instead of $.data (see #4346)
|
|
|
+ Utils.__cache = {};
|
|
|
+
|
|
|
+ var id = 0;
|
|
|
+ Utils.GetUniqueElementId = function (element) {
|
|
|
+ // Get a unique element Id. If element has no id,
|
|
|
+ // creates a new unique number, stores it in the id
|
|
|
+ // attribute and returns the new id.
|
|
|
+ // If an id already exists, it simply returns it.
|
|
|
+
|
|
|
+ var select2Id = element.getAttribute('data-select2-id');
|
|
|
+ if (select2Id == null) {
|
|
|
+ // If element has id, use it.
|
|
|
+ if (element.id) {
|
|
|
+ select2Id = element.id;
|
|
|
+ element.setAttribute('data-select2-id', select2Id);
|
|
|
+ } else {
|
|
|
+ element.setAttribute('data-select2-id', ++id);
|
|
|
+ select2Id = id.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return select2Id;
|
|
|
+ };
|
|
|
+
|
|
|
+ Utils.StoreData = function (element, name, value) {
|
|
|
+ // Stores an item in the cache for a specified element.
|
|
|
+ // name is the cache key.
|
|
|
+ var id = Utils.GetUniqueElementId(element);
|
|
|
+ if (!Utils.__cache[id]) {
|
|
|
+ Utils.__cache[id] = {};
|
|
|
+ }
|
|
|
+
|
|
|
+ Utils.__cache[id][name] = value;
|
|
|
+ };
|
|
|
+
|
|
|
+ Utils.GetData = function (element, name) {
|
|
|
+ // Retrieves a value from the cache by its key (name)
|
|
|
+ // name is optional. If no name specified, return
|
|
|
+ // all cache items for the specified element.
|
|
|
+ // and for a specified element.
|
|
|
+ var id = Utils.GetUniqueElementId(element);
|
|
|
+ if (name) {
|
|
|
+ if (Utils.__cache[id]) {
|
|
|
+ return Utils.__cache[id][name] != null ?
|
|
|
+ Utils.__cache[id][name]:
|
|
|
+ $(element).data(name); // Fallback to HTML5 data attribs.
|
|
|
+ }
|
|
|
+ return $(element).data(name); // Fallback to HTML5 data attribs.
|
|
|
+ } else {
|
|
|
+ return Utils.__cache[id];
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ Utils.RemoveData = function (element) {
|
|
|
+ // Removes all cached items for a specified element.
|
|
|
+ var id = Utils.GetUniqueElementId(element);
|
|
|
+ if (Utils.__cache[id] != null) {
|
|
|
+ delete Utils.__cache[id];
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
return Utils;
|
|
|
});
|
|
|
|
|
@@ -907,7 +968,7 @@ S2.define('select2/results',[
|
|
|
$options.each(function () {
|
|
|
var $option = $(this);
|
|
|
|
|
|
- var item = $.data(this, 'data');
|
|
|
+ var item = Utils.GetData(this, 'data');
|
|
|
|
|
|
// id needs to be converted to a string when comparing
|
|
|
var id = '' + item.id;
|
|
@@ -1012,7 +1073,7 @@ S2.define('select2/results',[
|
|
|
this.template(data, option);
|
|
|
}
|
|
|
|
|
|
- $.data(option, 'data', data);
|
|
|
+ Utils.StoreData(option, 'data', data);
|
|
|
|
|
|
return option;
|
|
|
};
|
|
@@ -1098,7 +1159,7 @@ S2.define('select2/results',[
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var data = $highlighted.data('data');
|
|
|
+ var data = Utils.GetData($highlighted[0], 'data');
|
|
|
|
|
|
if ($highlighted.attr('aria-selected') == 'true') {
|
|
|
self.trigger('close', {});
|
|
@@ -1210,7 +1271,7 @@ S2.define('select2/results',[
|
|
|
function (evt) {
|
|
|
var $this = $(this);
|
|
|
|
|
|
- var data = $this.data('data');
|
|
|
+ var data = Utils.GetData(this, 'data');
|
|
|
|
|
|
if ($this.attr('aria-selected') === 'true') {
|
|
|
if (self.options.get('multiple')) {
|
|
@@ -1233,7 +1294,7 @@ S2.define('select2/results',[
|
|
|
|
|
|
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
|
|
|
function (evt) {
|
|
|
- var data = $(this).data('data');
|
|
|
+ var data = Utils.GetData(this, 'data');
|
|
|
|
|
|
self.getHighlightedResults()
|
|
|
.removeClass('select2-results__option--highlighted');
|
|
@@ -1348,8 +1409,8 @@ S2.define('select2/selection/base',[
|
|
|
|
|
|
this._tabindex = 0;
|
|
|
|
|
|
- if (this.$element.data('old-tabindex') != null) {
|
|
|
- this._tabindex = this.$element.data('old-tabindex');
|
|
|
+ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
|
|
|
+ this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
|
|
|
} else if (this.$element.attr('tabindex') != null) {
|
|
|
this._tabindex = this.$element.attr('tabindex');
|
|
|
}
|
|
@@ -1457,7 +1518,7 @@ S2.define('select2/selection/base',[
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var $element = $this.data('element');
|
|
|
+ var $element = Utils.GetData(this, 'element');
|
|
|
|
|
|
$element.select2('close');
|
|
|
});
|
|
@@ -1518,7 +1579,10 @@ S2.define('select2/selection/single',[
|
|
|
|
|
|
var id = container.id + '-container';
|
|
|
|
|
|
- this.$selection.find('.select2-selection__rendered').attr('id', id);
|
|
|
+ this.$selection.find('.select2-selection__rendered')
|
|
|
+ .attr('id', id)
|
|
|
+ .attr('role', 'textbox')
|
|
|
+ .attr('aria-readonly', 'true');
|
|
|
this.$selection.attr('aria-labelledby', id);
|
|
|
|
|
|
this.$selection.on('mousedown', function (evt) {
|
|
@@ -1545,14 +1609,12 @@ S2.define('select2/selection/single',[
|
|
|
self.$selection.focus();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- container.on('selection:update', function (params) {
|
|
|
- self.update(params.data);
|
|
|
- });
|
|
|
};
|
|
|
|
|
|
SingleSelection.prototype.clear = function () {
|
|
|
- this.$selection.find('.select2-selection__rendered').empty();
|
|
|
+ var $rendered = this.$selection.find('.select2-selection__rendered');
|
|
|
+ $rendered.empty();
|
|
|
+ $rendered.removeAttr('title'); // clear tooltip on empty
|
|
|
};
|
|
|
|
|
|
SingleSelection.prototype.display = function (data, container) {
|
|
@@ -1578,7 +1640,7 @@ S2.define('select2/selection/single',[
|
|
|
var formatted = this.display(selection, $rendered);
|
|
|
|
|
|
$rendered.empty().append(formatted);
|
|
|
- $rendered.prop('title', selection.title || selection.text);
|
|
|
+ $rendered.attr('title', selection.title || selection.text);
|
|
|
};
|
|
|
|
|
|
return SingleSelection;
|
|
@@ -1630,7 +1692,7 @@ S2.define('select2/selection/multiple',[
|
|
|
var $remove = $(this);
|
|
|
var $selection = $remove.parent();
|
|
|
|
|
|
- var data = $selection.data('data');
|
|
|
+ var data = Utils.GetData($selection[0], 'data');
|
|
|
|
|
|
self.trigger('unselect', {
|
|
|
originalEvent: evt,
|
|
@@ -1641,7 +1703,9 @@ S2.define('select2/selection/multiple',[
|
|
|
};
|
|
|
|
|
|
MultipleSelection.prototype.clear = function () {
|
|
|
- this.$selection.find('.select2-selection__rendered').empty();
|
|
|
+ var $rendered = this.$selection.find('.select2-selection__rendered');
|
|
|
+ $rendered.empty();
|
|
|
+ $rendered.removeAttr('title');
|
|
|
};
|
|
|
|
|
|
MultipleSelection.prototype.display = function (data, container) {
|
|
@@ -1679,9 +1743,9 @@ S2.define('select2/selection/multiple',[
|
|
|
var formatted = this.display(selection, $selection);
|
|
|
|
|
|
$selection.append(formatted);
|
|
|
- $selection.prop('title', selection.title || selection.text);
|
|
|
+ $selection.attr('title', selection.title || selection.text);
|
|
|
|
|
|
- $selection.data('data', selection);
|
|
|
+ Utils.StoreData($selection[0], 'data', selection);
|
|
|
|
|
|
$selections.push($selection);
|
|
|
}
|
|
@@ -1746,8 +1810,9 @@ S2.define('select2/selection/placeholder',[
|
|
|
|
|
|
S2.define('select2/selection/allowClear',[
|
|
|
'jquery',
|
|
|
- '../keys'
|
|
|
-], function ($, KEYS) {
|
|
|
+ '../keys',
|
|
|
+ '../utils'
|
|
|
+], function ($, KEYS, Utils) {
|
|
|
function AllowClear () { }
|
|
|
|
|
|
AllowClear.prototype.bind = function (decorated, container, $container) {
|
|
@@ -1789,10 +1854,22 @@ S2.define('select2/selection/allowClear',[
|
|
|
|
|
|
evt.stopPropagation();
|
|
|
|
|
|
- var data = $clear.data('data');
|
|
|
+ var data = Utils.GetData($clear[0], 'data');
|
|
|
+
|
|
|
+ var previousVal = this.$element.val();
|
|
|
+ this.$element.val(this.placeholder.id);
|
|
|
+
|
|
|
+ var unselectData = {
|
|
|
+ data: data
|
|
|
+ };
|
|
|
+ this.trigger('clear', unselectData);
|
|
|
+ if (unselectData.prevented) {
|
|
|
+ this.$element.val(previousVal);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
for (var d = 0; d < data.length; d++) {
|
|
|
- var unselectData = {
|
|
|
+ unselectData = {
|
|
|
data: data[d]
|
|
|
};
|
|
|
|
|
@@ -1802,11 +1879,12 @@ S2.define('select2/selection/allowClear',[
|
|
|
|
|
|
// If the event was prevented, don't clear it out.
|
|
|
if (unselectData.prevented) {
|
|
|
+ this.$element.val(previousVal);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.$element.val(this.placeholder.id).trigger('change');
|
|
|
+ this.$element.trigger('change');
|
|
|
|
|
|
this.trigger('toggle', {});
|
|
|
};
|
|
@@ -1834,7 +1912,7 @@ S2.define('select2/selection/allowClear',[
|
|
|
'×' +
|
|
|
'</span>'
|
|
|
);
|
|
|
- $remove.data('data', data);
|
|
|
+ Utils.StoreData($remove[0], 'data', data);
|
|
|
|
|
|
this.$selection.find('.select2-selection__rendered').prepend($remove);
|
|
|
};
|
|
@@ -1925,7 +2003,7 @@ S2.define('select2/selection/search',[
|
|
|
.prev('.select2-selection__choice');
|
|
|
|
|
|
if ($previousChoice.length > 0) {
|
|
|
- var item = $previousChoice.data('data');
|
|
|
+ var item = Utils.GetData($previousChoice[0], 'data');
|
|
|
|
|
|
self.searchRemoveChoice(item);
|
|
|
|
|
@@ -2076,10 +2154,13 @@ S2.define('select2/selection/eventRelay',[
|
|
|
'open', 'opening',
|
|
|
'close', 'closing',
|
|
|
'select', 'selecting',
|
|
|
- 'unselect', 'unselecting'
|
|
|
+ 'unselect', 'unselecting',
|
|
|
+ 'clear', 'clearing'
|
|
|
];
|
|
|
|
|
|
- var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
|
|
|
+ var preventableEvents = [
|
|
|
+ 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
|
|
|
+ ];
|
|
|
|
|
|
decorated.call(this, container, $container);
|
|
|
|
|
@@ -3158,7 +3239,7 @@ S2.define('select2/data/select',[
|
|
|
// Remove anything added to child elements
|
|
|
this.$element.find('*').each(function () {
|
|
|
// Remove any custom data set by Select2
|
|
|
- $.removeData(this, 'data');
|
|
|
+ Utils.RemoveData(this);
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -3231,7 +3312,7 @@ S2.define('select2/data/select',[
|
|
|
normalizedData.element = option;
|
|
|
|
|
|
// Override the option's data with the combined data
|
|
|
- $.data(option, 'data', normalizedData);
|
|
|
+ Utils.StoreData(option, 'data', normalizedData);
|
|
|
|
|
|
return $option;
|
|
|
};
|
|
@@ -3239,7 +3320,7 @@ S2.define('select2/data/select',[
|
|
|
SelectAdapter.prototype.item = function ($option) {
|
|
|
var data = {};
|
|
|
|
|
|
- data = $.data($option[0], 'data');
|
|
|
+ data = Utils.GetData($option[0], 'data');
|
|
|
|
|
|
if (data != null) {
|
|
|
return data;
|
|
@@ -3277,13 +3358,13 @@ S2.define('select2/data/select',[
|
|
|
data = this._normalizeItem(data);
|
|
|
data.element = $option[0];
|
|
|
|
|
|
- $.data($option[0], 'data', data);
|
|
|
+ Utils.StoreData($option[0], 'data', data);
|
|
|
|
|
|
return data;
|
|
|
};
|
|
|
|
|
|
SelectAdapter.prototype._normalizeItem = function (item) {
|
|
|
- if (!$.isPlainObject(item)) {
|
|
|
+ if (item !== Object(item)) {
|
|
|
item = {
|
|
|
id: item,
|
|
|
text: item
|
|
@@ -3487,7 +3568,8 @@ S2.define('select2/data/ajax',[
|
|
|
}, function () {
|
|
|
// Attempt to detect if a request was aborted
|
|
|
// Only works if the transport exposes a status property
|
|
|
- if ($request.status && $request.status === '0') {
|
|
|
+ if ('status' in $request &&
|
|
|
+ ($request.status === 0 || $request.status === '0')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -3959,6 +4041,7 @@ S2.define('select2/dropdown/search',[
|
|
|
self.$search.attr('tabindex', -1);
|
|
|
|
|
|
self.$search.val('');
|
|
|
+ self.$search.blur();
|
|
|
});
|
|
|
|
|
|
container.on('focus', function () {
|
|
@@ -4224,14 +4307,14 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
|
|
|
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
|
|
$watchers.each(function () {
|
|
|
- $(this).data('select2-scroll-position', {
|
|
|
+ Utils.StoreData(this, 'select2-scroll-position', {
|
|
|
x: $(this).scrollLeft(),
|
|
|
y: $(this).scrollTop()
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$watchers.on(scrollEvent, function (ev) {
|
|
|
- var position = $(this).data('select2-scroll-position');
|
|
|
+ var position = Utils.GetData(this, 'select2-scroll-position');
|
|
|
$(this).scrollTop(position.y);
|
|
|
});
|
|
|
|
|
@@ -4396,8 +4479,8 @@ S2.define('select2/dropdown/minimumResultsForSearch',[
|
|
|
});
|
|
|
|
|
|
S2.define('select2/dropdown/selectOnClose',[
|
|
|
-
|
|
|
-], function () {
|
|
|
+ '../utils'
|
|
|
+], function (Utils) {
|
|
|
function SelectOnClose () { }
|
|
|
|
|
|
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
|
@@ -4428,7 +4511,7 @@ S2.define('select2/dropdown/selectOnClose',[
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- var data = $highlightedResults.data('data');
|
|
|
+ var data = Utils.GetData($highlightedResults[0], 'data');
|
|
|
|
|
|
// Don't re-select already selected resulte
|
|
|
if (
|
|
@@ -4916,7 +4999,7 @@ S2.define('select2/defaults',[
|
|
|
|
|
|
var convertedData = Utils._convertData(data);
|
|
|
|
|
|
- $.extend(this.defaults, convertedData);
|
|
|
+ $.extend(true, this.defaults, convertedData);
|
|
|
};
|
|
|
|
|
|
var defaults = new Defaults();
|
|
@@ -4981,7 +5064,7 @@ S2.define('select2/options',[
|
|
|
$e.prop('disabled', this.options.disabled);
|
|
|
$e.prop('multiple', this.options.multiple);
|
|
|
|
|
|
- if ($e.data('select2Tags')) {
|
|
|
+ if (Utils.GetData($e[0], 'select2Tags')) {
|
|
|
if (this.options.debug && window.console && console.warn) {
|
|
|
console.warn(
|
|
|
'Select2: The `data-select2-tags` attribute has been changed to ' +
|
|
@@ -4990,11 +5073,11 @@ S2.define('select2/options',[
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- $e.data('data', $e.data('select2Tags'));
|
|
|
- $e.data('tags', true);
|
|
|
+ Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
|
|
|
+ Utils.StoreData($e[0], 'tags', true);
|
|
|
}
|
|
|
|
|
|
- if ($e.data('ajaxUrl')) {
|
|
|
+ if (Utils.GetData($e[0], 'ajaxUrl')) {
|
|
|
if (this.options.debug && window.console && console.warn) {
|
|
|
console.warn(
|
|
|
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
|
@@ -5003,8 +5086,9 @@ S2.define('select2/options',[
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- $e.attr('ajax--url', $e.data('ajaxUrl'));
|
|
|
- $e.data('ajax--url', $e.data('ajaxUrl'));
|
|
|
+ $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
|
|
|
+ Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
var dataset = {};
|
|
@@ -5012,9 +5096,9 @@ S2.define('select2/options',[
|
|
|
// Prefer the element's `dataset` attribute if it exists
|
|
|
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
|
|
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
|
|
- dataset = $.extend(true, {}, $e[0].dataset, $e.data());
|
|
|
+ dataset = $.extend(true, {}, $e[0].dataset, Utils.GetData($e[0]));
|
|
|
} else {
|
|
|
- dataset = $e.data();
|
|
|
+ dataset = Utils.GetData($e[0]);
|
|
|
}
|
|
|
|
|
|
var data = $.extend(true, {}, dataset);
|
|
@@ -5054,8 +5138,8 @@ S2.define('select2/core',[
|
|
|
'./keys'
|
|
|
], function ($, Options, Utils, KEYS) {
|
|
|
var Select2 = function ($element, options) {
|
|
|
- if ($element.data('select2') != null) {
|
|
|
- $element.data('select2').destroy();
|
|
|
+ if (Utils.GetData($element[0], 'select2') != null) {
|
|
|
+ Utils.GetData($element[0], 'select2').destroy();
|
|
|
}
|
|
|
|
|
|
this.$element = $element;
|
|
@@ -5071,7 +5155,7 @@ S2.define('select2/core',[
|
|
|
// Set up the tabindex
|
|
|
|
|
|
var tabindex = $element.attr('tabindex') || 0;
|
|
|
- $element.data('old-tabindex', tabindex);
|
|
|
+ Utils.StoreData($element[0], 'old-tabindex', tabindex);
|
|
|
$element.attr('tabindex', '-1');
|
|
|
|
|
|
// Set up containers and adapters
|
|
@@ -5132,7 +5216,7 @@ S2.define('select2/core',[
|
|
|
// Synchronize any monitored attributes
|
|
|
this._syncAttributes();
|
|
|
|
|
|
- $element.data('select2', this);
|
|
|
+ Utils.StoreData($element[0], 'select2', this);
|
|
|
};
|
|
|
|
|
|
Utils.Extend(Select2, Utils.Observable);
|
|
@@ -5466,7 +5550,8 @@ S2.define('select2/core',[
|
|
|
'open': 'opening',
|
|
|
'close': 'closing',
|
|
|
'select': 'selecting',
|
|
|
- 'unselect': 'unselecting'
|
|
|
+ 'unselect': 'unselecting',
|
|
|
+ 'clear': 'clearing'
|
|
|
};
|
|
|
|
|
|
if (args === undefined) {
|
|
@@ -5621,11 +5706,12 @@ S2.define('select2/core',[
|
|
|
this._syncS = null;
|
|
|
|
|
|
this.$element.off('.select2');
|
|
|
- this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
|
|
+ this.$element.attr('tabindex',
|
|
|
+ Utils.GetData(this.$element[0], 'old-tabindex'));
|
|
|
|
|
|
this.$element.removeClass('select2-hidden-accessible');
|
|
|
this.$element.attr('aria-hidden', 'false');
|
|
|
- this.$element.removeData('select2');
|
|
|
+ Utils.RemoveData(this.$element[0]);
|
|
|
|
|
|
this.dataAdapter.destroy();
|
|
|
this.selection.destroy();
|
|
@@ -5652,7 +5738,7 @@ S2.define('select2/core',[
|
|
|
|
|
|
this.$container.addClass('select2-container--' + this.options.get('theme'));
|
|
|
|
|
|
- $container.data('element', this.$element);
|
|
|
+ Utils.StoreData($container[0], 'element', this.$element);
|
|
|
|
|
|
return $container;
|
|
|
};
|
|
@@ -5862,8 +5948,9 @@ S2.define('select2/compat/initSelection',[
|
|
|
});
|
|
|
|
|
|
S2.define('select2/compat/inputData',[
|
|
|
- 'jquery'
|
|
|
-], function ($) {
|
|
|
+ 'jquery',
|
|
|
+ '../utils'
|
|
|
+], function ($, Utils) {
|
|
|
function InputData (decorated, $element, options) {
|
|
|
this._currentData = [];
|
|
|
this._valueSeparator = options.get('valueSeparator') || ',';
|
|
@@ -5980,7 +6067,7 @@ S2.define('select2/compat/inputData',[
|
|
|
|
|
|
InputData.prototype.addOptions = function (_, $options) {
|
|
|
var options = $.map($options, function ($option) {
|
|
|
- return $.data($option[0], 'data');
|
|
|
+ return Utils.GetData($option[0], 'data');
|
|
|
});
|
|
|
|
|
|
this._currentData.push.apply(this._currentData, options);
|
|
@@ -6383,8 +6470,9 @@ S2.define('jquery.select2',[
|
|
|
'jquery-mousewheel',
|
|
|
|
|
|
'./select2/core',
|
|
|
- './select2/defaults'
|
|
|
-], function ($, _, Select2, Defaults) {
|
|
|
+ './select2/defaults',
|
|
|
+ './select2/utils'
|
|
|
+], function ($, _, Select2, Defaults, Utils) {
|
|
|
if ($.fn.select2 == null) {
|
|
|
// All methods that should return the element
|
|
|
var thisMethods = ['open', 'close', 'destroy'];
|
|
@@ -6405,7 +6493,7 @@ S2.define('jquery.select2',[
|
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
|
|
this.each(function () {
|
|
|
- var instance = $(this).data('select2');
|
|
|
+ var instance = Utils.GetData(this, 'select2');
|
|
|
|
|
|
if (instance == null && window.console && console.error) {
|
|
|
console.error(
|