datatables.net 2.3.6 → 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.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.3.6
1
+ /*! DataTables 2.3.8
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -448,7 +448,7 @@
448
448
  if ( tfoot.length === 0 ) {
449
449
  // If we are a scrolling table, and no footer has been given, then we need to create
450
450
  // a tfoot element for the caption element to be appended to
451
- tfoot = $('<tfoot/>').insertAfter(thead);
451
+ tfoot = $('<tfoot/>').appendTo($this);
452
452
  }
453
453
  oSettings.nTFoot = tfoot[0];
454
454
 
@@ -3595,6 +3595,11 @@
3595
3595
  if ( holdPosition !== true ) {
3596
3596
  settings._iDisplayStart = 0;
3597
3597
  }
3598
+ else {
3599
+ // Keep position, but make sure that there is actually data to display,
3600
+ // otherwise we need to rewind a bit (e.g. if rows were deleted)
3601
+ _fnLengthOverflow(settings);
3602
+ }
3598
3603
 
3599
3604
  // Let any modules know about the draw hold position state (used by
3600
3605
  // scrolling internally)
@@ -4908,6 +4913,12 @@
4908
4913
 
4909
4914
  var args = [settings, settings.json];
4910
4915
 
4916
+ // If the footer element is empty after initialisation, then remove it
4917
+ let tfoot = $(settings.tfoot);
4918
+ if (tfoot.children().length === 0) {
4919
+ tfoot.remove();
4920
+ }
4921
+
4911
4922
  settings._bInitComplete = true;
4912
4923
 
4913
4924
  // Table is fully set up and we have data, so calculate the
@@ -5364,12 +5375,12 @@
5364
5375
  // the content of the cell so that the width applied to the header and body
5365
5376
  // both match, but we want to hide it completely.
5366
5377
  $('th, td', headerCopy).each(function () {
5367
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5378
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5368
5379
  });
5369
5380
 
5370
5381
  if ( footer ) {
5371
5382
  $('th, td', footerCopy).each(function () {
5372
- $(this.childNodes).wrapAll('<div class="dt-scroll-sizing">');
5383
+ $(this.childNodes).wrapAll('<div class="dt-scroll-sizing" />');
5373
5384
  });
5374
5385
  }
5375
5386
 
@@ -5397,6 +5408,10 @@
5397
5408
  // Correct DOM ordering for colgroup - comes before the thead
5398
5409
  table.children('colgroup').prependTo(table);
5399
5410
 
5411
+ // Remove tabindex from the hidden row elements
5412
+ table.find('thead, tfoot').find('[tabindex]').removeAttr('tabindex');
5413
+ table.find('thead, tfoot').find('role').removeAttr('role');
5414
+
5400
5415
  // Adjust the position of the header in case we loose the y-scrollbar
5401
5416
  divBody.trigger('scroll');
5402
5417
 
@@ -5720,8 +5735,12 @@
5720
5735
  .replace(/id=".*?"/g, '')
5721
5736
  .replace(/name=".*?"/g, '');
5722
5737
 
5723
- // Don't want Javascript at all in these calculation cells.
5724
- cellString = cellString.replace(/<script.*?<\/script>/gi, ' ');
5738
+ // Don't want script, dialog or template tags in the width
5739
+ // calculations as they are hidden content
5740
+ cellString = cellString
5741
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
5742
+ .replace(/<dialog[\s\S]*?<\/dialog>/gi, ' ')
5743
+ .replace(/<template[\s\S]*?<\/template>/gi, ' ');
5725
5744
 
5726
5745
  var noHtml = _stripHtml(cellString, ' ')
5727
5746
  .replace( /&nbsp;/g, ' ' );
@@ -8884,6 +8903,10 @@
8884
8903
  return null;
8885
8904
  }
8886
8905
 
8906
+ if (col.responsiveVisible === false) {
8907
+ return null;
8908
+ }
8909
+
8887
8910
  // Selector
8888
8911
  if (match[1]) {
8889
8912
  return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
@@ -10288,7 +10311,7 @@
10288
10311
  * @type string
10289
10312
  * @default Version number
10290
10313
  */
10291
- DataTable.version = "2.3.6";
10314
+ DataTable.version = "2.3.8";
10292
10315
 
10293
10316
  /**
10294
10317
  * Private data store, containing all of the settings objects that are
@@ -12570,6 +12593,7 @@
12570
12593
  var __mlWarning = false;
12571
12594
  var __luxon; // Can be assigned in DateTable.use()
12572
12595
  var __moment; // Can be assigned in DateTable.use()
12596
+ var __reIsoTimezone = /[T\s]\d{2}.*?(Z|[+-]\d{2}(?::?\d{2})?)$/;
12573
12597
 
12574
12598
  /**
12575
12599
  *
@@ -12590,7 +12614,7 @@
12590
12614
  resolveWindowLibs();
12591
12615
 
12592
12616
  if (__moment) {
12593
- dt = __moment.utc( d, format, locale, true );
12617
+ dt = __moment( d, format, locale, true );
12594
12618
 
12595
12619
  if (! dt.isValid()) {
12596
12620
  return null;
@@ -12700,6 +12724,16 @@
12700
12724
  return d;
12701
12725
  }
12702
12726
 
12727
+ // Determine if there is a timezone. If there is, we want to reuse
12728
+ // it for the output, so the timezone doesn't change between the
12729
+ // input and output.
12730
+ let options = {};
12731
+ let tzMatch = typeof d === 'string' ? d.match(__reIsoTimezone) : null;
12732
+
12733
+ if (tzMatch) {
12734
+ options.timeZone = tzMatch[1] === 'Z' ? 'UTC' : tzMatch[1];
12735
+ }
12736
+
12703
12737
  var dt = __mldObj(d, from, locale);
12704
12738
 
12705
12739
  if (dt === null) {
@@ -12713,7 +12747,7 @@
12713
12747
  var formatted = to === null
12714
12748
  ? __mld(dt, 'toDate', 'toJSDate', '')[localeString](
12715
12749
  navigator.language,
12716
- { timeZone: "UTC" }
12750
+ options
12717
12751
  )
12718
12752
  : __mld(dt, 'format', 'toFormat', 'toISOString', to);
12719
12753