Skip to content

Commit

Permalink
1eddf57e55486c9e69581f14f77a2c3cd58b43f4 Fix: Polyfill for String.pro…
Browse files Browse the repository at this point in the history
…totype.includes

Sync to source repo @1eddf57e55486c9e69581f14f77a2c3cd58b43f4
  • Loading branch information
AllanJard committed Sep 23, 2021
1 parent c12b06c commit 5047dd5
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 49 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
],
"src-repo": "http://github.com/DataTables/DataTablesSrc",
"last-tag": "1.11.2",
"last-sync": "af651f6ab12052c1cb5d67cb73ad3284e2c296cb"
"last-sync": "1eddf57e55486c9e69581f14f77a2c3cd58b43f4"
}
20 changes: 13 additions & 7 deletions js/jquery.dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,14 @@
return out;
}

var _includes = function (search, start) {
if (start === undefined) {
start = 0;
}

return this.indexOf(search, start) !== -1;
};

// Array.isArray polyfill.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
if (! Array.isArray) {
Expand All @@ -1623,13 +1631,7 @@
}

if (! Array.prototype.includes) {
Array.prototype.includes = function (search, start) {
if (start === undefined) {
start = 0;
}

return this.indexOf(search, start) !== -1;
};
Array.prototype.includes = _includes;
}

// .trim() polyfill
Expand All @@ -1640,6 +1642,10 @@
};
}

if (! String.prototype.includes) {
String.prototype.includes = _includes;
}

/**
* DataTables utility methods
*
Expand Down
Loading

0 comments on commit 5047dd5

Please sign in to comment.