datatables.net 2.1.6 → 2.1.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,11 +1,11 @@
1
- /*! DataTables 2.1.6
1
+ /*! DataTables 2.1.8
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
5
  /**
6
6
  * @summary DataTables
7
7
  * @description Paginate, search and order HTML tables
8
- * @version 2.1.6
8
+ * @version 2.1.8
9
9
  * @author SpryMedia Ltd
10
10
  * @contact www.datatables.net
11
11
  * @copyright SpryMedia Ltd.
@@ -1318,8 +1318,11 @@
1318
1318
  }
1319
1319
 
1320
1320
  // It is faster to just run `normalize` than it is to check if
1321
- // we need to with a regex!
1322
- var res = str.normalize("NFD");
1321
+ // we need to with a regex! (Check as it isn't available in old
1322
+ // Safari)
1323
+ var res = str.normalize
1324
+ ? str.normalize("NFD")
1325
+ : str;
1323
1326
 
1324
1327
  // Equally, here we check if a regex is needed or not
1325
1328
  return res.length !== str.length
@@ -2157,11 +2160,7 @@
2157
2160
  for (var i=0 ; i<cols.length ; i++) {
2158
2161
  var width = _fnColumnsSumWidth(settings, [i], false, false);
2159
2162
 
2160
- // Need to set the min-width, otherwise the browser might try to collapse
2161
- // it further
2162
- cols[i].colEl
2163
- .css('width', width)
2164
- .css('min-width', width);
2163
+ cols[i].colEl.css('width', width);
2165
2164
  }
2166
2165
  }
2167
2166
 
@@ -2258,7 +2257,7 @@
2258
2257
  */
2259
2258
  function _typeResult (typeDetect, res) {
2260
2259
  return res === true
2261
- ? typeDetect.name
2260
+ ? typeDetect._name
2262
2261
  : res;
2263
2262
  }
2264
2263
 
@@ -3041,8 +3040,8 @@
3041
3040
  * @returns
3042
3041
  */
3043
3042
  function _fnGetRowDisplay (settings, rowIdx) {
3044
- let rowModal = settings.aoData[rowIdx];
3045
- let columns = settings.aoColumns;
3043
+ var rowModal = settings.aoData[rowIdx];
3044
+ var columns = settings.aoColumns;
3046
3045
 
3047
3046
  if (! rowModal.displayData) {
3048
3047
  // Need to render and cache
@@ -3248,9 +3247,6 @@
3248
3247
  settings.aoFooter = detected;
3249
3248
  }
3250
3249
 
3251
- // ARIA role for the rows
3252
- $(target).children('tr').attr('role', 'row');
3253
-
3254
3250
  // Every cell needs to be passed through the renderer
3255
3251
  $(target).children('tr').children('th, td')
3256
3252
  .each( function () {
@@ -5240,7 +5236,7 @@
5240
5236
  // browser support
5241
5237
  var firstTr = null;
5242
5238
 
5243
- for (i=0 ; i<settings.aiDisplay.length ; i++) {
5239
+ for (i=settings._iDisplayStart ; i<settings.aiDisplay.length ; i++) {
5244
5240
  var idx = settings.aiDisplay[i];
5245
5241
  var tr = settings.aoData[idx].nTr;
5246
5242
 
@@ -5408,11 +5404,7 @@
5408
5404
  var width = _fnColumnsSumWidth( settings, this, true, false );
5409
5405
 
5410
5406
  if ( width ) {
5411
- // Need to set the width and min-width, otherwise the browser
5412
- // will attempt to collapse the table beyond want might have
5413
- // been specified
5414
5407
  this.style.width = width;
5415
- this.style.minWidth = width;
5416
5408
 
5417
5409
  // For scrollX we need to force the column width otherwise the
5418
5410
  // browser will collapse it. If this width is smaller than the
@@ -7714,7 +7706,7 @@
7714
7706
  // Reduce the API instance to the first item found
7715
7707
  var _selector_first = function ( old )
7716
7708
  {
7717
- let inst = new _Api(old.context[0]);
7709
+ var inst = new _Api(old.context[0]);
7718
7710
 
7719
7711
  // Use a push rather than passing to the constructor, since it will
7720
7712
  // merge arrays down automatically, which isn't what is wanted here
@@ -9709,7 +9701,7 @@
9709
9701
  fn.call(this);
9710
9702
  }
9711
9703
  else {
9712
- this.on('init', function () {
9704
+ this.on('init.dt.DT', function () {
9713
9705
  fn.call(this);
9714
9706
  });
9715
9707
  }
@@ -9862,7 +9854,7 @@
9862
9854
  * @type string
9863
9855
  * @default Version number
9864
9856
  */
9865
- DataTable.version = "2.1.6";
9857
+ DataTable.version = "2.1.8";
9866
9858
 
9867
9859
  /**
9868
9860
  * Private data store, containing all of the settings objects that are
@@ -12187,7 +12179,7 @@
12187
12179
 
12188
12180
  // Add type detection and sorting specific to this date format - we need to be able to identify
12189
12181
  // date type columns as such, rather than as numbers in extensions. Hence the need for this.
12190
- if (! DataTable.ext.type.order[typeName]) {
12182
+ if (! DataTable.ext.type.order[typeName + '-pre']) {
12191
12183
  DataTable.type(typeName, {
12192
12184
  detect: function (d) {
12193
12185
  // The renderer will give the value to type detect as the type!
@@ -12426,7 +12418,7 @@
12426
12418
  return {
12427
12419
  className: _extTypes.className[name],
12428
12420
  detect: _extTypes.detect.find(function (fn) {
12429
- return fn.name === name;
12421
+ return fn._name === name;
12430
12422
  }),
12431
12423
  order: {
12432
12424
  pre: _extTypes.order[name + '-pre'],
@@ -12444,10 +12436,10 @@
12444
12436
  var setDetect = function (detect) {
12445
12437
  // `detect` can be a function or an object - we set a name
12446
12438
  // property for either - that is used for the detection
12447
- Object.defineProperty(detect, "name", {value: name});
12439
+ Object.defineProperty(detect, "_name", {value: name});
12448
12440
 
12449
12441
  var idx = _extTypes.detect.findIndex(function (item) {
12450
- return item.name === name;
12442
+ return item._name === name;
12451
12443
  });
12452
12444
 
12453
12445
  if (idx === -1) {
@@ -12510,13 +12502,13 @@
12510
12502
  // Get a list of types
12511
12503
  DataTable.types = function () {
12512
12504
  return _extTypes.detect.map(function (fn) {
12513
- return fn.name;
12505
+ return fn._name;
12514
12506
  });
12515
12507
  };
12516
12508
 
12517
12509
  var __diacriticSort = function (a, b) {
12518
- a = a.toString().toLowerCase();
12519
- b = b.toString().toLowerCase();
12510
+ a = a !== null && a !== undefined ? a.toString().toLowerCase() : '';
12511
+ b = b !== null && b !== undefined ? b.toString().toLowerCase() : '';
12520
12512
 
12521
12513
  // Checked for `navigator.languages` support in `oneOf` so this code can't execute in old
12522
12514
  // Safari and thus can disable this check
@@ -13230,15 +13222,17 @@
13230
13222
  all = len === -1,
13231
13223
  page = all ? 0 : Math.ceil( start / len ),
13232
13224
  pages = all ? 1 : Math.ceil( visRecords / len ),
13233
- buttons = plugin(opts)
13225
+ buttons = [],
13226
+ buttonEls = [],
13227
+ buttonsNested = plugin(opts)
13234
13228
  .map(function (val) {
13235
13229
  return val === 'numbers'
13236
13230
  ? _pagingNumbers(page, pages, opts.buttons, opts.boundaryNumbers)
13237
13231
  : val;
13238
- })
13239
- .flat();
13232
+ });
13240
13233
 
13241
- var buttonEls = [];
13234
+ // .flat() would be better, but not supported in old Safari
13235
+ buttons = buttons.concat.apply(buttons, buttonsNested);
13242
13236
 
13243
13237
  for (var i=0 ; i<buttons.length ; i++) {
13244
13238
  var button = buttons[i];
@@ -13517,14 +13511,14 @@
13517
13511
 
13518
13512
  // Save text node content for macro updating
13519
13513
  var textNodes = [];
13520
- div.find('label')[0].childNodes.forEach(function (el) {
13514
+ Array.from(div.find('label')[0].childNodes).forEach(function (el) {
13521
13515
  if (el.nodeType === Node.TEXT_NODE) {
13522
13516
  textNodes.push({
13523
13517
  el: el,
13524
13518
  text: el.textContent
13525
13519
  });
13526
13520
  }
13527
- })
13521
+ });
13528
13522
 
13529
13523
  // Update the label text in case it has an entries value
13530
13524
  var updateEntries = function (len) {