Handle special characters in object ids
Slight performance hit as we are no longer using `qurySelectorAll`, but it handles the situation a bit more cleanly and prevent future issues with special characters. This closes https://github.com/select2/select2/issues/3157.
This commit is contained in:
parent
1f62eb67e8
commit
14279a012b
4
dist/js/select2.full.js
vendored
4
dist/js/select2.full.js
vendored
@ -3136,7 +3136,9 @@ S2.define('select2/data/array',[
|
||||
Utils.Extend(ArrayAdapter, SelectAdapter);
|
||||
|
||||
ArrayAdapter.prototype.select = function (data) {
|
||||
var $option = this.$element.find('option[value="' + data.id + '"]');
|
||||
var $option = this.$element.find('option').filter(function (i, elm) {
|
||||
return elm.value == data.id.toString();
|
||||
});
|
||||
|
||||
if ($option.length === 0) {
|
||||
$option = this.option(data);
|
||||
|
4
dist/js/select2.full.min.js
vendored
4
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
4
dist/js/select2.js
vendored
4
dist/js/select2.js
vendored
@ -3136,7 +3136,9 @@ S2.define('select2/data/array',[
|
||||
Utils.Extend(ArrayAdapter, SelectAdapter);
|
||||
|
||||
ArrayAdapter.prototype.select = function (data) {
|
||||
var $option = this.$element.find('option[value="' + data.id + '"]');
|
||||
var $option = this.$element.find('option').filter(function (i, elm) {
|
||||
return elm.value == data.id.toString();
|
||||
});
|
||||
|
||||
if ($option.length === 0) {
|
||||
$option = this.option(data);
|
||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
4
src/js/select2/data/array.js
vendored
4
src/js/select2/data/array.js
vendored
@ -14,7 +14,9 @@ define([
|
||||
Utils.Extend(ArrayAdapter, SelectAdapter);
|
||||
|
||||
ArrayAdapter.prototype.select = function (data) {
|
||||
var $option = this.$element.find('option[value="' + data.id + '"]');
|
||||
var $option = this.$element.find('option').filter(function (i, elm) {
|
||||
return elm.value == data.id.toString();
|
||||
});
|
||||
|
||||
if ($option.length === 0) {
|
||||
$option = this.option(data);
|
||||
|
Loading…
Reference in New Issue
Block a user