Skip to content

Commit

Permalink
f353db012effe3d5cf90195cf5b0b3036333bd52 Fix: Remove the use of `Arra…
Browse files Browse the repository at this point in the history
…y.prototype.flat()` as it wasn't supported in Safari until v12

https://datatables.net/forums/discussion/79829

Sync to source repo @f353db012effe3d5cf90195cf5b0b3036333bd52
  • Loading branch information
dtbuild committed Sep 12, 2024
1 parent 24e77e7 commit 210caef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
],
"src-repo": "http://github.com/DataTables/DataTablesSrc",
"last-tag": "2.1.6",
"last-sync": "cfcb5d9c77fadc54f90ebe80edf0c8cc4c9b9b76"
"last-sync": "f353db012effe3d5cf90195cf5b0b3036333bd52"
}
10 changes: 6 additions & 4 deletions js/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -13230,15 +13230,17 @@
all = len === -1,
page = all ? 0 : Math.ceil( start / len ),
pages = all ? 1 : Math.ceil( visRecords / len ),
buttons = plugin(opts)
buttons = [],
buttonEls = [],
buttonsNested = plugin(opts)
.map(function (val) {
return val === 'numbers'
? _pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
: val;
})
.flat();
});

var buttonEls = [];
// .flat() would be better, but not supported in old Safari
buttons = buttons.concat.apply(buttons, buttonsNested);

for (var i=0 ; i<buttons.length ; i++) {
var button = buttons[i];
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.min.mjs

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions js/dataTables.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13177,15 +13177,17 @@ function _pagingDraw(settings, host, opts) {
all = len === -1,
page = all ? 0 : Math.ceil( start / len ),
pages = all ? 1 : Math.ceil( visRecords / len ),
buttons = plugin(opts)
buttons = [],
buttonEls = [],
buttonsNested = plugin(opts)
.map(function (val) {
return val === 'numbers'
? _pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
: val;
})
.flat();
});

var buttonEls = [];
// .flat() would be better, but not supported in old Safari
buttons = buttons.concat.apply(buttons, buttonsNested);

for (var i=0 ; i<buttons.length ; i++) {
var button = buttons[i];
Expand Down

0 comments on commit 210caef

Please sign in to comment.