Skip to content

Commit 5047dd5

Browse files
committed
1eddf57e55486c9e69581f14f77a2c3cd58b43f4 Fix: Polyfill for String.prototype.includes
Sync to source repo @1eddf57e55486c9e69581f14f77a2c3cd58b43f4
1 parent c12b06c commit 5047dd5

File tree

3 files changed

+55
-49
lines changed

3 files changed

+55
-49
lines changed

datatables.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
],
1010
"src-repo": "http://github.com/DataTables/DataTablesSrc",
1111
"last-tag": "1.11.2",
12-
"last-sync": "af651f6ab12052c1cb5d67cb73ad3284e2c296cb"
12+
"last-sync": "1eddf57e55486c9e69581f14f77a2c3cd58b43f4"
1313
}

js/jquery.dataTables.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,14 @@
16141614
return out;
16151615
}
16161616

1617+
var _includes = function (search, start) {
1618+
if (start === undefined) {
1619+
start = 0;
1620+
}
1621+
1622+
return this.indexOf(search, start) !== -1;
1623+
};
1624+
16171625
// Array.isArray polyfill.
16181626
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
16191627
if (! Array.isArray) {
@@ -1623,13 +1631,7 @@
16231631
}
16241632

16251633
if (! Array.prototype.includes) {
1626-
Array.prototype.includes = function (search, start) {
1627-
if (start === undefined) {
1628-
start = 0;
1629-
}
1630-
1631-
return this.indexOf(search, start) !== -1;
1632-
};
1634+
Array.prototype.includes = _includes;
16331635
}
16341636

16351637
// .trim() polyfill
@@ -1640,6 +1642,10 @@
16401642
};
16411643
}
16421644

1645+
if (! String.prototype.includes) {
1646+
String.prototype.includes = _includes;
1647+
}
1648+
16431649
/**
16441650
* DataTables utility methods
16451651
*

0 commit comments

Comments
 (0)