1
0
mirror of synced 2024-11-22 13:06:08 +03:00

replaced usages of [].indexOf with $.inArray()

X-Browser Compatibility (and performance) reasons.

Signed-off-by: Kevin Brown <kevin@kevinbrown.in>
This commit is contained in:
th3byrdm4n 2015-02-14 13:37:18 -10:00 committed by Kevin Brown
parent e75cd78c51
commit 07c4db1de2
10 changed files with 29 additions and 29 deletions

View File

@ -352,7 +352,7 @@ define('select2/results',[
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
if ($.inArray(item.id, selectedIds) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
@ -2394,7 +2394,7 @@ define('select2/data/select',[
for (var d = 0; d < data.length; d++) {
var id = data[d].id;
if (val.indexOf(id) === -1) {
if ($.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2432,7 +2432,7 @@ define('select2/data/select',[
for (var d = 0; d < currentData.length; d++) {
var id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
if (id !== data.id && $.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2971,7 +2971,7 @@ define('select2/data/tokenizer',[
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
if ($.inArray(termChar, separators) === -1) {
i++;
continue;
@ -4121,7 +4121,7 @@ define('select2/options',[
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
if ($.inArray(key, excludedData) > -1) {
continue;
}

View File

@ -352,7 +352,7 @@ define('select2/results',[
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
if ($.inArray(item.id, selectedIds) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
@ -2394,7 +2394,7 @@ define('select2/data/select',[
for (var d = 0; d < data.length; d++) {
var id = data[d].id;
if (val.indexOf(id) === -1) {
if ($.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2432,7 +2432,7 @@ define('select2/data/select',[
for (var d = 0; d < currentData.length; d++) {
var id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
if (id !== data.id && $.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2971,7 +2971,7 @@ define('select2/data/tokenizer',[
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
if ($.inArray(termChar, separators) === -1) {
i++;
continue;
@ -4121,7 +4121,7 @@ define('select2/options',[
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
if ($.inArray(key, excludedData) > -1) {
continue;
}

View File

@ -791,7 +791,7 @@ define('select2/results',[
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
if ($.inArray(item.id, selectedIds) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
@ -2833,7 +2833,7 @@ define('select2/data/select',[
for (var d = 0; d < data.length; d++) {
var id = data[d].id;
if (val.indexOf(id) === -1) {
if ($.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2871,7 +2871,7 @@ define('select2/data/select',[
for (var d = 0; d < currentData.length; d++) {
var id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
if (id !== data.id && $.inArray(id, val) === -1) {
val.push(id);
}
}
@ -3410,7 +3410,7 @@ define('select2/data/tokenizer',[
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
if ($.inArray(termChar, separators) === -1) {
i++;
continue;
@ -4560,7 +4560,7 @@ define('select2/options',[
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
if ($.inArray(key, excludedData) > -1) {
continue;
}

File diff suppressed because one or more lines are too long

10
dist/js/select2.js vendored
View File

@ -791,7 +791,7 @@ define('select2/results',[
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
if ($.inArray(item.id, selectedIds) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
@ -2833,7 +2833,7 @@ define('select2/data/select',[
for (var d = 0; d < data.length; d++) {
var id = data[d].id;
if (val.indexOf(id) === -1) {
if ($.inArray(id, val) === -1) {
val.push(id);
}
}
@ -2871,7 +2871,7 @@ define('select2/data/select',[
for (var d = 0; d < currentData.length; d++) {
var id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
if (id !== data.id && $.inArray(id, val) === -1) {
val.push(id);
}
}
@ -3410,7 +3410,7 @@ define('select2/data/tokenizer',[
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
if ($.inArray(termChar, separators) === -1) {
i++;
continue;
@ -4560,7 +4560,7 @@ define('select2/options',[
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
if ($.inArray(key, excludedData) > -1) {
continue;
}

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ define([
for (var d = 0; d < data.length; d++) {
var id = data[d].id;
if (val.indexOf(id) === -1) {
if ($.inArray(id, val) === -1) {
val.push(id);
}
}
@ -87,7 +87,7 @@ define([
for (var d = 0; d < currentData.length; d++) {
var id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
if (id !== data.id && $.inArray(id, val) === -1) {
val.push(id);
}
}

View File

@ -57,7 +57,7 @@ define([
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
if ($.inArray(termChar, separators) === -1) {
i++;
continue;

View File

@ -75,7 +75,7 @@ define([
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
if ($.inArray(key, excludedData) > -1) {
continue;
}

View File

@ -106,7 +106,7 @@ define([
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
if ($.inArray(item.id, selectedIds) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');