Update select2.js
As suggested in https://github.com/ivaynberg/select2/issues/781#issuecomment-38979100, significantly improves search speed, going from unusable to snappy on IE on a list of almost 10,000 items with a custom query limiting it to 25 results. Uses 'uni range + named function' from http://jsperf.com/diacritics/18
This commit is contained in:
parent
24f4bbfefb
commit
7c9c9612b5
14
select2.js
14
select2.js
@ -114,16 +114,12 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stripDiacritics(str) {
|
function stripDiacritics(str) {
|
||||||
var ret, i, l, c;
|
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
||||||
|
function match(a) {
|
||||||
if (!str || str.length < 1) return str;
|
return DIACRITICS[a] || a;
|
||||||
|
|
||||||
ret = "";
|
|
||||||
for (i = 0, l = str.length; i < l; i++) {
|
|
||||||
c = str.charAt(i);
|
|
||||||
ret += DIACRITICS[c] || c;
|
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
return str.replace(/[^\u0000-\u007E]/g, match);
|
||||||
}
|
}
|
||||||
|
|
||||||
function indexOf(value, array) {
|
function indexOf(value, array) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user