datatables.net 2.3.7 → 2.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js/dataTables.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.3.7
1
+ /*! DataTables 2.3.8
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -3560,6 +3560,11 @@ function _fnReDraw( settings, holdPosition, recompute )
3560
3560
  if ( holdPosition !== true ) {
3561
3561
  settings._iDisplayStart = 0;
3562
3562
  }
3563
+ else {
3564
+ // Keep position, but make sure that there is actually data to display,
3565
+ // otherwise we need to rewind a bit (e.g. if rows were deleted)
3566
+ _fnLengthOverflow(settings);
3567
+ }
3563
3568
 
3564
3569
  // Let any modules know about the draw hold position state (used by
3565
3570
  // scrolling internally)
@@ -4873,6 +4878,12 @@ function _fnInitComplete ( settings )
4873
4878
 
4874
4879
  var args = [settings, settings.json];
4875
4880
 
4881
+ // If the footer element is empty after initialisation, then remove it
4882
+ let tfoot = $(settings.tfoot);
4883
+ if (tfoot.children().length === 0) {
4884
+ tfoot.remove();
4885
+ }
4886
+
4876
4887
  settings._bInitComplete = true;
4877
4888
 
4878
4889
  // Table is fully set up and we have data, so calculate the
@@ -5329,12 +5340,12 @@ function _fnScrollDraw ( settings )
5329
5340
  // the content of the cell so that the width applied to the header and body
5330
5341
  // both match, but we want to hide it completely.
5331
5342
  $('th, td', headerCopy).each(function () {
5332
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5343
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5333
5344
  });
5334
5345
 
5335
5346
  if ( footer ) {
5336
5347
  $('th, td', footerCopy).each(function () {
5337
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5348
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5338
5349
  });
5339
5350
  }
5340
5351
 
@@ -5362,6 +5373,10 @@ function _fnScrollDraw ( settings )
5362
5373
  // Correct DOM ordering for colgroup - comes before the thead
5363
5374
  table.children('colgroup').prependTo(table);
5364
5375
 
5376
+ // Remove tabindex from the hidden row elements
5377
+ table.find('thead, tfoot').find('[tabindex]').removeAttr('tabindex');
5378
+ table.find('thead, tfoot').find('role').removeAttr('role');
5379
+
5365
5380
  // Adjust the position of the header in case we loose the y-scrollbar
5366
5381
  divBody.trigger('scroll');
5367
5382
 
@@ -5685,8 +5700,12 @@ function _fnGetWideStrings( settings, colIdx )
5685
5700
  .replace(/id=".*?"/g, '')
5686
5701
  .replace(/name=".*?"/g, '');
5687
5702
 
5688
- // Don't want Javascript at all in these calculation cells.
5689
- cellString = cellString.replace(/<script.*?<\/script>/gi, ' ');
5703
+ // Don't want script, dialog or template tags in the width
5704
+ // calculations as they are hidden content
5705
+ cellString = cellString
5706
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
5707
+ .replace(/<dialog[\s\S]*?<\/dialog>/gi, ' ')
5708
+ .replace(/<template[\s\S]*?<\/template>/gi, ' ');
5690
5709
 
5691
5710
  var noHtml = _stripHtml(cellString, ' ')
5692
5711
  .replace( /&nbsp;/g, ' ' );
@@ -10257,7 +10276,7 @@ function cleanHeader(node, className) {
10257
10276
  * @type string
10258
10277
  * @default Version number
10259
10278
  */
10260
- DataTable.version = "2.3.7";
10279
+ DataTable.version = "2.3.8";
10261
10280
 
10262
10281
  /**
10263
10282
  * Private data store, containing all of the settings objects that are
@@ -12539,6 +12558,7 @@ function __mld( dtLib, momentFn, luxonFn, dateFn, arg1 ) {
12539
12558
  var __mlWarning = false;
12540
12559
  var __luxon; // Can be assigned in DateTable.use()
12541
12560
  var __moment; // Can be assigned in DateTable.use()
12561
+ var __reIsoTimezone = /[T\s]\d{2}.*?(Z|[+-]\d{2}(?::?\d{2})?)$/;
12542
12562
 
12543
12563
  /**
12544
12564
  *
@@ -12559,7 +12579,7 @@ function __mldObj (d, format, locale) {
12559
12579
  resolveWindowLibs();
12560
12580
 
12561
12581
  if (__moment) {
12562
- dt = __moment.utc( d, format, locale, true );
12582
+ dt = __moment( d, format, locale, true );
12563
12583
 
12564
12584
  if (! dt.isValid()) {
12565
12585
  return null;
@@ -12669,6 +12689,16 @@ function __mlHelper (localeString) {
12669
12689
  return d;
12670
12690
  }
12671
12691
 
12692
+ // Determine if there is a timezone. If there is, we want to reuse
12693
+ // it for the output, so the timezone doesn't change between the
12694
+ // input and output.
12695
+ let options = {};
12696
+ let tzMatch = typeof d === 'string' ? d.match(__reIsoTimezone) : null;
12697
+
12698
+ if (tzMatch) {
12699
+ options.timeZone = tzMatch[1] === 'Z' ? 'UTC' : tzMatch[1];
12700
+ }
12701
+
12672
12702
  var dt = __mldObj(d, from, locale);
12673
12703
 
12674
12704
  if (dt === null) {
@@ -12682,7 +12712,7 @@ function __mlHelper (localeString) {
12682
12712
  var formatted = to === null
12683
12713
  ? __mld(dt, 'toDate', 'toJSDate', '')[localeString](
12684
12714
  navigator.language,
12685
- { timeZone: "UTC" }
12715
+ options
12686
12716
  )
12687
12717
  : __mld(dt, 'format', 'toFormat', 'toISOString', to);
12688
12718
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "datatables.net",
3
- "description": "jQuery DataTables",
3
+ "description": "DataTables - The Javascript table library",
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.3.7",
7
+ "version": "2.3.8",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",