datatables.net 1.10.18 → 1.10.22

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.
@@ -1,15 +1,15 @@
1
- /*! DataTables 1.10.19-dev
2
- * ©2008-2018 SpryMedia Ltd - datatables.net/license
1
+ /*! DataTables 1.10.22
2
+ * ©2008-2020 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 1.10.19-dev
8
+ * @version 1.10.22
9
9
  * @file jquery.dataTables.js
10
10
  * @author SpryMedia Ltd
11
11
  * @contact www.datatables.net
12
- * @copyright Copyright 2008-2018 SpryMedia Ltd.
12
+ * @copyright Copyright 2008-2020 SpryMedia Ltd.
13
13
  *
14
14
  * This source file is free software, available under the following license:
15
15
  * MIT license - http://datatables.net/license
@@ -251,7 +251,7 @@
251
251
  var api = this.api( true );
252
252
 
253
253
  /* Check if we want to add multiple rows or not */
254
- var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ?
254
+ var rows = Array.isArray(data) && ( Array.isArray(data[0]) || $.isPlainObject(data[0]) ) ?
255
255
  api.rows.add( data ) :
256
256
  api.row.add( data );
257
257
 
@@ -898,7 +898,7 @@
898
898
  _fnCamelToHungarian( defaults.column, defaults.column, true );
899
899
 
900
900
  /* Setting up the initialisation object */
901
- _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ) );
901
+ _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ), true );
902
902
 
903
903
 
904
904
 
@@ -975,7 +975,7 @@
975
975
  // If the length menu is given, but the init display length is not, use the length menu
976
976
  if ( oInit.aLengthMenu && ! oInit.iDisplayLength )
977
977
  {
978
- oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ?
978
+ oInit.iDisplayLength = Array.isArray( oInit.aLengthMenu[0] ) ?
979
979
  oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];
980
980
  }
981
981
 
@@ -1066,7 +1066,7 @@
1066
1066
  if ( oInit.iDeferLoading !== null )
1067
1067
  {
1068
1068
  oSettings.bDeferLoading = true;
1069
- var tmp = $.isArray( oInit.iDeferLoading );
1069
+ var tmp = Array.isArray( oInit.iDeferLoading );
1070
1070
  oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;
1071
1071
  oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;
1072
1072
  }
@@ -1334,7 +1334,7 @@
1334
1334
  var _api_registerPlural; // DataTable.Api.registerPlural
1335
1335
 
1336
1336
  var _re_dic = {};
1337
- var _re_new_lines = /[\r\n]/g;
1337
+ var _re_new_lines = /[\r\n\u2028]/g;
1338
1338
  var _re_html = /<.*?>/g;
1339
1339
 
1340
1340
  // This is not strict ISO8601 - Date.parse() is quite lax, although
@@ -1356,7 +1356,7 @@
1356
1356
  // - Ƀ - Bitcoin
1357
1357
  // - Ξ - Ethereum
1358
1358
  // standards as thousands separators.
1359
- var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;
1359
+ var _re_formatted_numeric = /['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;
1360
1360
 
1361
1361
 
1362
1362
  var _empty = function ( d ) {
@@ -1584,6 +1584,36 @@
1584
1584
  return out;
1585
1585
  };
1586
1586
 
1587
+ // Surprisingly this is faster than [].concat.apply
1588
+ // https://jsperf.com/flatten-an-array-loop-vs-reduce/2
1589
+ var _flatten = function (out, val) {
1590
+ if (Array.isArray(val)) {
1591
+ for (var i=0 ; i<val.length ; i++) {
1592
+ _flatten(out, val[i]);
1593
+ }
1594
+ }
1595
+ else {
1596
+ out.push(val);
1597
+ }
1598
+
1599
+ return out;
1600
+ }
1601
+
1602
+ // Array.isArray polyfill.
1603
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
1604
+ if (! Array.isArray) {
1605
+ Array.isArray = function(arg) {
1606
+ return Object.prototype.toString.call(arg) === '[object Array]';
1607
+ };
1608
+ }
1609
+
1610
+ // .trim() polyfill
1611
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
1612
+ if (!String.prototype.trim) {
1613
+ String.prototype.trim = function () {
1614
+ return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
1615
+ };
1616
+ }
1587
1617
 
1588
1618
  /**
1589
1619
  * DataTables utility methods
@@ -1841,7 +1871,7 @@
1841
1871
 
1842
1872
  // orderData can be given as an integer
1843
1873
  var dataSort = init.aDataSort;
1844
- if ( typeof dataSort === 'number' && ! $.isArray( dataSort ) ) {
1874
+ if ( typeof dataSort === 'number' && ! Array.isArray( dataSort ) ) {
1845
1875
  init.aDataSort = [ dataSort ];
1846
1876
  }
1847
1877
  }
@@ -2024,7 +2054,7 @@
2024
2054
  _fnCompatCols( oOptions );
2025
2055
 
2026
2056
  // Map camel case parameters to their Hungarian counterparts
2027
- _fnCamelToHungarian( DataTable.defaults.column, oOptions );
2057
+ _fnCamelToHungarian( DataTable.defaults.column, oOptions, true );
2028
2058
 
2029
2059
  /* Backwards compatibility for mDataProp */
2030
2060
  if ( oOptions.mDataProp !== undefined && !oOptions.mData )
@@ -2325,7 +2355,7 @@
2325
2355
  def.targets :
2326
2356
  def.aTargets;
2327
2357
 
2328
- if ( ! $.isArray( aTargets ) )
2358
+ if ( ! Array.isArray( aTargets ) )
2329
2359
  {
2330
2360
  aTargets = [ aTargets ];
2331
2361
  }
@@ -2644,7 +2674,7 @@
2644
2674
  innerSrc = a.join('.');
2645
2675
 
2646
2676
  // Traverse each entry in the array getting the properties requested
2647
- if ( $.isArray( data ) ) {
2677
+ if ( Array.isArray( data ) ) {
2648
2678
  for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
2649
2679
  out.push( fetchData( data[j], type, innerSrc ) );
2650
2680
  }
@@ -2732,6 +2762,11 @@
2732
2762
 
2733
2763
  for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
2734
2764
  {
2765
+ // Protect against prototype pollution
2766
+ if (a[i] === '__proto__') {
2767
+ throw new Error('Cannot set prototype values');
2768
+ }
2769
+
2735
2770
  // Check if we are dealing with an array notation request
2736
2771
  arrayNotation = a[i].match(__reArray);
2737
2772
  funcNotation = a[i].match(__reFn);
@@ -2747,7 +2782,7 @@
2747
2782
  innerSrc = b.join('.');
2748
2783
 
2749
2784
  // Traverse each entry in the array setting the properties requested
2750
- if ( $.isArray( val ) )
2785
+ if ( Array.isArray( val ) )
2751
2786
  {
2752
2787
  for ( var j=0, jLen=val.length ; j<jLen ; j++ )
2753
2788
  {
@@ -2994,7 +3029,7 @@
2994
3029
  var cellProcess = function ( cell ) {
2995
3030
  if ( colIdx === undefined || colIdx === i ) {
2996
3031
  col = columns[i];
2997
- contents = $.trim(cell.innerHTML);
3032
+ contents = (cell.innerHTML).trim();
2998
3033
 
2999
3034
  if ( col && col._bAttrSrc ) {
3000
3035
  var setter = _fnSetObjectDataFn( col.mData._ );
@@ -3078,7 +3113,7 @@
3078
3113
  rowData = row._aData,
3079
3114
  cells = [],
3080
3115
  nTr, nTd, oCol,
3081
- i, iLen;
3116
+ i, iLen, create;
3082
3117
 
3083
3118
  if ( row.nTr === null )
3084
3119
  {
@@ -3099,8 +3134,9 @@
3099
3134
  for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
3100
3135
  {
3101
3136
  oCol = oSettings.aoColumns[i];
3137
+ create = nTrIn ? false : true;
3102
3138
 
3103
- nTd = nTrIn ? anTds[i] : document.createElement( oCol.sCellType );
3139
+ nTd = create ? document.createElement( oCol.sCellType ) : anTds[i];
3104
3140
  nTd._DT_CellIndex = {
3105
3141
  row: iRow,
3106
3142
  column: i
@@ -3109,9 +3145,9 @@
3109
3145
  cells.push( nTd );
3110
3146
 
3111
3147
  // Need to create the HTML if new, or if a rendering function is defined
3112
- if ( (!nTrIn || oCol.mRender || oCol.mData !== i) &&
3148
+ if ( create || ((!nTrIn || oCol.mRender || oCol.mData !== i) &&
3113
3149
  (!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')
3114
- ) {
3150
+ )) {
3115
3151
  nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
3116
3152
  }
3117
3153
 
@@ -3243,11 +3279,11 @@
3243
3279
  }
3244
3280
 
3245
3281
  /* ARIA role for the rows */
3246
- $(thead).find('>tr').attr('role', 'row');
3282
+ $(thead).children('tr').attr('role', 'row');
3247
3283
 
3248
3284
  /* Deal with the footer - add classes if required */
3249
- $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );
3250
- $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );
3285
+ $(thead).children('tr').children('th, td').addClass( classes.sHeaderTH );
3286
+ $(tfoot).children('tr').children('th, td').addClass( classes.sFooterTH );
3251
3287
 
3252
3288
  // Cache the footer cells. Note that we only take the cells from the first
3253
3289
  // row in the footer. If there is more than one row the user wants to
@@ -3833,7 +3869,7 @@
3833
3869
 
3834
3870
  // Convert to object based for 1.10+ if using the old array scheme which can
3835
3871
  // come from server-side processing or serverParams
3836
- if ( data && $.isArray(data) ) {
3872
+ if ( data && Array.isArray(data) ) {
3837
3873
  var tmp = {};
3838
3874
  var rbracket = /(.*?)\[\]$/;
3839
3875
 
@@ -4111,7 +4147,7 @@
4111
4147
  var recordsTotal = compat( 'iTotalRecords', 'recordsTotal' );
4112
4148
  var recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' );
4113
4149
 
4114
- if ( draw ) {
4150
+ if ( draw !== undefined ) {
4115
4151
  // Protect against out of sequence returns
4116
4152
  if ( draw*1 < settings.iDraw ) {
4117
4153
  return;
@@ -4226,6 +4262,14 @@
4226
4262
  _fnThrottle( searchFn, searchDelay ) :
4227
4263
  searchFn
4228
4264
  )
4265
+ .on( 'mouseup', function(e) {
4266
+ // Edge fix! Edge 17 does not trigger anything other than mouse events when clicking
4267
+ // on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
4268
+ // checks the value to see if it has changed. In other browsers it won't have.
4269
+ setTimeout( function () {
4270
+ searchFn.call(jqFilter[0]);
4271
+ }, 10);
4272
+ } )
4229
4273
  .on( 'keypress.DT', function(e) {
4230
4274
  /* Prevent form submission */
4231
4275
  if ( e.keyCode == 13 ) {
@@ -4406,6 +4450,7 @@
4406
4450
  // New search - start from the master array
4407
4451
  if ( invalidated ||
4408
4452
  force ||
4453
+ regex ||
4409
4454
  prevSearch.length > input.length ||
4410
4455
  input.indexOf(prevSearch) !== 0 ||
4411
4456
  settings.bSorted // On resort, the display master needs to be
@@ -4529,7 +4574,7 @@
4529
4574
  }
4530
4575
 
4531
4576
  if ( cellData.replace ) {
4532
- cellData = cellData.replace(/[\r\n]/g, '');
4577
+ cellData = cellData.replace(/[\r\n\u2028]/g, '');
4533
4578
  }
4534
4579
 
4535
4580
  filterData.push( cellData );
@@ -4809,7 +4854,7 @@
4809
4854
  classes = settings.oClasses,
4810
4855
  tableId = settings.sTableId,
4811
4856
  menu = settings.aLengthMenu,
4812
- d2 = $.isArray( menu[0] ),
4857
+ d2 = Array.isArray( menu[0] ),
4813
4858
  lengths = d2 ? menu[0] : menu,
4814
4859
  language = d2 ? menu[1] : menu;
4815
4860
 
@@ -5159,10 +5204,10 @@
5159
5204
  } );
5160
5205
  }
5161
5206
 
5162
- $(scrollBody).css(
5163
- scrollY && scroll.bCollapse ? 'max-height' : 'height',
5164
- scrollY
5165
- );
5207
+ $(scrollBody).css('max-height', scrollY);
5208
+ if (! scroll.bCollapse) {
5209
+ $(scrollBody).css('height', scrollY);
5210
+ }
5166
5211
 
5167
5212
  settings.nScrollHead = scrollHead;
5168
5213
  settings.nScrollBody = scrollBody;
@@ -5457,7 +5502,7 @@
5457
5502
  table.children('colgroup').insertBefore( table.children('thead') );
5458
5503
 
5459
5504
  /* Adjust the position of the header in case we loose the y-scrollbar */
5460
- divBody.scroll();
5505
+ divBody.trigger('scroll');
5461
5506
 
5462
5507
  // If sorting or filtering has occurred, jump the scrolling back to the top
5463
5508
  // only if we aren't holding the position
@@ -5855,7 +5900,7 @@
5855
5900
  fixedObj = $.isPlainObject( fixed ),
5856
5901
  nestedSort = [],
5857
5902
  add = function ( a ) {
5858
- if ( a.length && ! $.isArray( a[0] ) ) {
5903
+ if ( a.length && ! Array.isArray( a[0] ) ) {
5859
5904
  // 1D array
5860
5905
  nestedSort.push( a );
5861
5906
  }
@@ -5867,7 +5912,7 @@
5867
5912
 
5868
5913
  // Build the sort array, with pre-fix and post-fix options if they have been
5869
5914
  // specified
5870
- if ( $.isArray( fixed ) ) {
5915
+ if ( Array.isArray( fixed ) ) {
5871
5916
  add( fixed );
5872
5917
  }
5873
5918
 
@@ -6410,7 +6455,7 @@
6410
6455
 
6411
6456
  _fnCallbackFire( settings, 'aoStateLoaded', 'stateLoaded', [settings, s] );
6412
6457
  callback();
6413
- }
6458
+ };
6414
6459
 
6415
6460
  if ( ! settings.oFeatures.bStateSave ) {
6416
6461
  callback();
@@ -6496,9 +6541,9 @@
6496
6541
  */
6497
6542
  function _fnMap( ret, src, name, mappedName )
6498
6543
  {
6499
- if ( $.isArray( name ) ) {
6544
+ if ( Array.isArray( name ) ) {
6500
6545
  $.each( name, function (i, val) {
6501
- if ( $.isArray( val ) ) {
6546
+ if ( Array.isArray( val ) ) {
6502
6547
  _fnMap( ret, src, val[0], val[1] );
6503
6548
  }
6504
6549
  else {
@@ -6550,7 +6595,7 @@
6550
6595
  }
6551
6596
  $.extend( true, out[prop], val );
6552
6597
  }
6553
- else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {
6598
+ else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && Array.isArray(val) ) {
6554
6599
  out[prop] = val.slice();
6555
6600
  }
6556
6601
  else {
@@ -6576,7 +6621,7 @@
6576
6621
  {
6577
6622
  $(n)
6578
6623
  .on( 'click.DT', oData, function (e) {
6579
- $(n).blur(); // Remove focus outline for mouse users
6624
+ $(n).trigger('blur'); // Remove focus outline for mouse users
6580
6625
  fn(e);
6581
6626
  } )
6582
6627
  .on( 'keypress.DT', oData, function (e){
@@ -6890,11 +6935,11 @@
6890
6935
  var ctxSettings = function ( o ) {
6891
6936
  var a = _toSettings( o );
6892
6937
  if ( a ) {
6893
- settings = settings.concat( a );
6938
+ settings.push.apply( settings, a );
6894
6939
  }
6895
6940
  };
6896
6941
 
6897
- if ( $.isArray( context ) ) {
6942
+ if ( Array.isArray( context ) ) {
6898
6943
  for ( var i=0, ien=context.length ; i<ien ; i++ ) {
6899
6944
  ctxSettings( context[i] );
6900
6945
  }
@@ -7188,8 +7233,7 @@
7188
7233
 
7189
7234
  var
7190
7235
  i, ien,
7191
- j, jen,
7192
- struct, inner,
7236
+ struct,
7193
7237
  methodScoping = function ( scope, fn, struc ) {
7194
7238
  return function () {
7195
7239
  var ret = fn.apply( scope, arguments );
@@ -7204,9 +7248,9 @@
7204
7248
  struct = ext[i];
7205
7249
 
7206
7250
  // Value
7207
- obj[ struct.name ] = typeof struct.val === 'function' ?
7251
+ obj[ struct.name ] = struct.type === 'function' ?
7208
7252
  methodScoping( scope, struct.val, struct ) :
7209
- $.isPlainObject( struct.val ) ?
7253
+ struct.type === 'object' ?
7210
7254
  {} :
7211
7255
  struct.val;
7212
7256
 
@@ -7253,7 +7297,7 @@
7253
7297
 
7254
7298
  _Api.register = _api_register = function ( name, val )
7255
7299
  {
7256
- if ( $.isArray( name ) ) {
7300
+ if ( Array.isArray( name ) ) {
7257
7301
  for ( var j=0, jen=name.length ; j<jen ; j++ ) {
7258
7302
  _Api.register( name[j], val );
7259
7303
  }
@@ -7287,13 +7331,19 @@
7287
7331
  name: key,
7288
7332
  val: {},
7289
7333
  methodExt: [],
7290
- propExt: []
7334
+ propExt: [],
7335
+ type: 'object'
7291
7336
  };
7292
7337
  struct.push( src );
7293
7338
  }
7294
7339
 
7295
7340
  if ( i === ien-1 ) {
7296
7341
  src.val = val;
7342
+ src.type = typeof val === 'function' ?
7343
+ 'function' :
7344
+ $.isPlainObject( val ) ?
7345
+ 'object' :
7346
+ 'other';
7297
7347
  }
7298
7348
  else {
7299
7349
  struct = method ?
@@ -7303,7 +7353,6 @@
7303
7353
  }
7304
7354
  };
7305
7355
 
7306
-
7307
7356
  _Api.registerPlural = _api_registerPlural = function ( pluralName, singularName, val ) {
7308
7357
  _Api.register( pluralName, val );
7309
7358
 
@@ -7318,7 +7367,7 @@
7318
7367
  // New API instance returned, want the value from the first item
7319
7368
  // in the returned array for the singular result.
7320
7369
  return ret.length ?
7321
- $.isArray( ret[0] ) ?
7370
+ Array.isArray( ret[0] ) ?
7322
7371
  new _Api( ret.context, ret[0] ) : // Array results are 'enhanced'
7323
7372
  ret[0] :
7324
7373
  undefined;
@@ -7341,6 +7390,12 @@
7341
7390
  */
7342
7391
  var __table_selector = function ( selector, a )
7343
7392
  {
7393
+ if ( Array.isArray(selector) ) {
7394
+ return $.map( selector, function (item) {
7395
+ return __table_selector(item, a);
7396
+ } );
7397
+ }
7398
+
7344
7399
  // Integer is used to pick out a table by index
7345
7400
  if ( typeof selector === 'number' ) {
7346
7401
  return [ a[ selector ] ];
@@ -7376,7 +7431,7 @@
7376
7431
  */
7377
7432
  _api_register( 'tables()', function ( selector ) {
7378
7433
  // A new instance is created if there was a selector specified
7379
- return selector ?
7434
+ return selector !== undefined && selector !== null ?
7380
7435
  new _Api( __table_selector( selector, this.context ) ) :
7381
7436
  this;
7382
7437
  } );
@@ -7724,7 +7779,7 @@
7724
7779
  [ selector[i] ];
7725
7780
 
7726
7781
  for ( j=0, jen=a.length ; j<jen ; j++ ) {
7727
- res = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] );
7782
+ res = selectFn( typeof a[j] === 'string' ? (a[j]).trim() : a[j] );
7728
7783
 
7729
7784
  if ( res && res.length ) {
7730
7785
  out = out.concat( res );
@@ -7916,7 +7971,7 @@
7916
7971
  [];
7917
7972
  }
7918
7973
  else if ( cellIdx ) {
7919
- return aoData[ cellIdx.row ] && aoData[ cellIdx.row ].nTr === sel ?
7974
+ return aoData[ cellIdx.row ] && aoData[ cellIdx.row ].nTr === sel.parentNode ?
7920
7975
  [ cellIdx.row ] :
7921
7976
  [];
7922
7977
  }
@@ -8150,7 +8205,7 @@
8150
8205
  row._aData = data;
8151
8206
 
8152
8207
  // If the DOM has an id, and the data source is an array
8153
- if ( $.isArray( data ) && row.nTr.id ) {
8208
+ if ( Array.isArray( data ) && row.nTr && row.nTr.id ) {
8154
8209
  _fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id );
8155
8210
  }
8156
8211
 
@@ -8196,7 +8251,7 @@
8196
8251
  var rows = [];
8197
8252
  var addRow = function ( r, k ) {
8198
8253
  // Recursion to allow for arrays of jQuery objects
8199
- if ( $.isArray( r ) || r instanceof $ ) {
8254
+ if ( Array.isArray( r ) || r instanceof $ ) {
8200
8255
  for ( var i=0, ien=r.length ; i<ien ; i++ ) {
8201
8256
  addRow( r[i], k );
8202
8257
  }
@@ -8210,7 +8265,7 @@
8210
8265
  }
8211
8266
  else {
8212
8267
  // Otherwise create a row with a wrapper
8213
- var created = $('<tr><td/></tr>').addClass( k );
8268
+ var created = $('<tr><td></td></tr>').addClass( k );
8214
8269
  $('td', created)
8215
8270
  .addClass( k )
8216
8271
  .html( r )
@@ -8575,16 +8630,6 @@
8575
8630
 
8576
8631
  // Common actions
8577
8632
  col.bVisible = vis;
8578
- _fnDrawHead( settings, settings.aoHeader );
8579
- _fnDrawHead( settings, settings.aoFooter );
8580
-
8581
- // Update colspan for no records display. Child rows and extensions will use their own
8582
- // listeners to do this - only need to update the empty table item here
8583
- if ( ! settings.aiDisplay.length ) {
8584
- $(settings.nTBody).find('td[colspan]').attr('colspan', _fnVisbleColumns(settings));
8585
- }
8586
-
8587
- _fnSaveState( settings );
8588
8633
  };
8589
8634
 
8590
8635
 
@@ -8648,6 +8693,7 @@
8648
8693
  } );
8649
8694
 
8650
8695
  _api_registerPlural( 'columns().visible()', 'column().visible()', function ( vis, calc ) {
8696
+ var that = this;
8651
8697
  var ret = this.iterator( 'column', function ( settings, column ) {
8652
8698
  if ( vis === undefined ) {
8653
8699
  return settings.aoColumns[ column ].bVisible;
@@ -8657,14 +8703,28 @@
8657
8703
 
8658
8704
  // Group the column visibility changes
8659
8705
  if ( vis !== undefined ) {
8660
- // Second loop once the first is done for events
8661
- this.iterator( 'column', function ( settings, column ) {
8662
- _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, calc] );
8663
- } );
8706
+ this.iterator( 'table', function ( settings ) {
8707
+ // Redraw the header after changes
8708
+ _fnDrawHead( settings, settings.aoHeader );
8709
+ _fnDrawHead( settings, settings.aoFooter );
8710
+
8711
+ // Update colspan for no records display. Child rows and extensions will use their own
8712
+ // listeners to do this - only need to update the empty table item here
8713
+ if ( ! settings.aiDisplay.length ) {
8714
+ $(settings.nTBody).find('td[colspan]').attr('colspan', _fnVisbleColumns(settings));
8715
+ }
8716
+
8717
+ _fnSaveState( settings );
8664
8718
 
8665
- if ( calc === undefined || calc ) {
8666
- this.columns.adjust();
8667
- }
8719
+ // Second loop once the first is done for events
8720
+ that.iterator( 'column', function ( settings, column ) {
8721
+ _fnCallbackFire( settings, null, 'column-visibility', [settings, column, vis, calc] );
8722
+ } );
8723
+
8724
+ if ( calc === undefined || calc ) {
8725
+ that.columns.adjust();
8726
+ }
8727
+ });
8668
8728
  }
8669
8729
 
8670
8730
  return ret;
@@ -8701,14 +8761,12 @@
8701
8761
  return _selector_first( this.columns( selector, opts ) );
8702
8762
  } );
8703
8763
 
8704
-
8705
-
8706
8764
  var __cell_selector = function ( settings, selector, opts )
8707
8765
  {
8708
8766
  var data = settings.aoData;
8709
8767
  var rows = _selector_row_indexes( settings, opts );
8710
8768
  var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );
8711
- var allCells = $( [].concat.apply([], cells) );
8769
+ var allCells = $(_flatten( [], cells ));
8712
8770
  var row;
8713
8771
  var columns = settings.aoColumns.length;
8714
8772
  var a, i, ien, j, o, host;
@@ -8815,13 +8873,20 @@
8815
8873
  } );
8816
8874
  }
8817
8875
 
8876
+ // The default built in options need to apply to row and columns
8877
+ var internalOpts = opts ? {
8878
+ page: opts.page,
8879
+ order: opts.order,
8880
+ search: opts.search
8881
+ } : {};
8882
+
8818
8883
  // Row + column selector
8819
- var columns = this.columns( columnSelector );
8820
- var rows = this.rows( rowSelector );
8821
- var a, i, ien, j, jen;
8884
+ var columns = this.columns( columnSelector, internalOpts );
8885
+ var rows = this.rows( rowSelector, internalOpts );
8886
+ var i, ien, j, jen;
8822
8887
 
8823
- this.iterator( 'table', function ( settings, idx ) {
8824
- a = [];
8888
+ var cellsNoOpts = this.iterator( 'table', function ( settings, idx ) {
8889
+ var a = [];
8825
8890
 
8826
8891
  for ( i=0, ien=rows[idx].length ; i<ien ; i++ ) {
8827
8892
  for ( j=0, jen=columns[idx].length ; j<jen ; j++ ) {
@@ -8831,10 +8896,16 @@
8831
8896
  } );
8832
8897
  }
8833
8898
  }
8899
+
8900
+ return a;
8834
8901
  }, 1 );
8835
8902
 
8836
- // Now pass through the cell selector for options
8837
- var cells = this.cells( a, opts );
8903
+ // There is currently only one extension which uses a cell selector extension
8904
+ // It is a _major_ performance drag to run this if it isn't needed, so this is
8905
+ // an extension specific check at the moment
8906
+ var cells = opts && opts.selected ?
8907
+ this.cells( cellsNoOpts, opts ) :
8908
+ cellsNoOpts;
8838
8909
 
8839
8910
  $.extend( cells.selector, {
8840
8911
  cols: columnSelector,
@@ -8967,7 +9038,7 @@
8967
9038
  // Simple column / direction passed in
8968
9039
  order = [ [ order, dir ] ];
8969
9040
  }
8970
- else if ( order.length && ! $.isArray( order[0] ) ) {
9041
+ else if ( order.length && ! Array.isArray( order[0] ) ) {
8971
9042
  // Arguments passed in (list of 1D arrays)
8972
9043
  order = Array.prototype.slice.call( arguments );
8973
9044
  }
@@ -9003,7 +9074,7 @@
9003
9074
  ctx[0].aaSortingFixed :
9004
9075
  undefined;
9005
9076
 
9006
- return $.isArray( fixed ) ?
9077
+ return Array.isArray( fixed ) ?
9007
9078
  { pre: fixed } :
9008
9079
  fixed;
9009
9080
  }
@@ -9463,7 +9534,7 @@
9463
9534
  * @type string
9464
9535
  * @default Version number
9465
9536
  */
9466
- DataTable.version = "1.10.19-dev";
9537
+ DataTable.version = "1.10.22";
9467
9538
 
9468
9539
  /**
9469
9540
  * Private data store, containing all of the settings objects that are
@@ -9881,8 +9952,8 @@
9881
9952
  * version is still, internally the primary interface, but is is not documented
9882
9953
  * - hence the @name tags in each doc comment. This allows a Javascript function
9883
9954
  * to create a map from Hungarian notation to camel case (going the other direction
9884
- * would require each property to be listed, which would at around 3K to the size
9885
- * of DataTables, while this method is about a 0.5K hit.
9955
+ * would require each property to be listed, which would add around 3K to the size
9956
+ * of DataTables, while this method is about a 0.5K hit).
9886
9957
  *
9887
9958
  * Ultimately this does pave the way for Hungarian notation to be dropped
9888
9959
  * completely, but that is a massive amount of work and will break current
@@ -10981,7 +11052,9 @@
10981
11052
  'DataTables_'+settings.sInstance+'_'+location.pathname
10982
11053
  )
10983
11054
  );
10984
- } catch (e) {}
11055
+ } catch (e) {
11056
+ return {};
11057
+ }
10985
11058
  },
10986
11059
 
10987
11060
 
@@ -14526,7 +14599,8 @@
14526
14599
  var btnDisplay, btnClass, counter=0;
14527
14600
 
14528
14601
  var attach = function( container, buttons ) {
14529
- var i, ien, node, button;
14602
+ var i, ien, node, button, tabIndex;
14603
+ var disabledClass = classes.sPageButtonDisabled;
14530
14604
  var clickHandler = function ( e ) {
14531
14605
  _fnPageChange( settings, e.data.action, true );
14532
14606
  };
@@ -14534,14 +14608,15 @@
14534
14608
  for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
14535
14609
  button = buttons[i];
14536
14610
 
14537
- if ( $.isArray( button ) ) {
14611
+ if ( Array.isArray( button ) ) {
14538
14612
  var inner = $( '<'+(button.DT_el || 'div')+'/>' )
14539
14613
  .appendTo( container );
14540
14614
  attach( inner, button );
14541
14615
  }
14542
14616
  else {
14543
14617
  btnDisplay = null;
14544
- btnClass = '';
14618
+ btnClass = button;
14619
+ tabIndex = settings.iTabIndex;
14545
14620
 
14546
14621
  switch ( button ) {
14547
14622
  case 'ellipsis':
@@ -14550,30 +14625,42 @@
14550
14625
 
14551
14626
  case 'first':
14552
14627
  btnDisplay = lang.sFirst;
14553
- btnClass = button + (page > 0 ?
14554
- '' : ' '+classes.sPageButtonDisabled);
14628
+
14629
+ if ( page === 0 ) {
14630
+ tabIndex = -1;
14631
+ btnClass += ' ' + disabledClass;
14632
+ }
14555
14633
  break;
14556
14634
 
14557
14635
  case 'previous':
14558
14636
  btnDisplay = lang.sPrevious;
14559
- btnClass = button + (page > 0 ?
14560
- '' : ' '+classes.sPageButtonDisabled);
14637
+
14638
+ if ( page === 0 ) {
14639
+ tabIndex = -1;
14640
+ btnClass += ' ' + disabledClass;
14641
+ }
14561
14642
  break;
14562
14643
 
14563
14644
  case 'next':
14564
14645
  btnDisplay = lang.sNext;
14565
- btnClass = button + (page < pages-1 ?
14566
- '' : ' '+classes.sPageButtonDisabled);
14646
+
14647
+ if ( pages === 0 || page === pages-1 ) {
14648
+ tabIndex = -1;
14649
+ btnClass += ' ' + disabledClass;
14650
+ }
14567
14651
  break;
14568
14652
 
14569
14653
  case 'last':
14570
14654
  btnDisplay = lang.sLast;
14571
- btnClass = button + (page < pages-1 ?
14572
- '' : ' '+classes.sPageButtonDisabled);
14655
+
14656
+ if ( pages === 0 || page === pages-1 ) {
14657
+ tabIndex = -1;
14658
+ btnClass += ' ' + disabledClass;
14659
+ }
14573
14660
  break;
14574
14661
 
14575
14662
  default:
14576
- btnDisplay = button + 1;
14663
+ btnDisplay = settings.fnFormatNumber( button + 1 );
14577
14664
  btnClass = page === button ?
14578
14665
  classes.sPageButtonActive : '';
14579
14666
  break;
@@ -14585,7 +14672,7 @@
14585
14672
  'aria-controls': settings.sTableId,
14586
14673
  'aria-label': aria[ button ],
14587
14674
  'data-dt-idx': counter,
14588
- 'tabindex': settings.iTabIndex,
14675
+ 'tabindex': tabIndex,
14589
14676
  'id': idx === 0 && typeof button === 'string' ?
14590
14677
  settings.sTableId +'_'+ button :
14591
14678
  null
@@ -14620,7 +14707,7 @@
14620
14707
  attach( $(host).empty(), buttons );
14621
14708
 
14622
14709
  if ( activeEl !== undefined ) {
14623
- $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
14710
+ $(host).find( '[data-dt-idx='+activeEl+']' ).trigger('focus');
14624
14711
  }
14625
14712
  }
14626
14713
  }
@@ -14906,7 +14993,11 @@
14906
14993
 
14907
14994
  var __htmlEscapeEntities = function ( d ) {
14908
14995
  return typeof d === 'string' ?
14909
- d.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;') :
14996
+ d
14997
+ .replace(/&/g, '&amp;')
14998
+ .replace(/</g, '&lt;')
14999
+ .replace(/>/g, '&gt;')
15000
+ .replace(/"/g, '&quot;') :
14910
15001
  d;
14911
15002
  };
14912
15003
 
@@ -15213,7 +15304,7 @@
15213
15304
 
15214
15305
  /**
15215
15306
  * Processing event, fired when DataTables is doing some kind of processing
15216
- * (be it, order, searcg or anything else). It can be used to indicate to
15307
+ * (be it, order, search or anything else). It can be used to indicate to
15217
15308
  * the end user that there is something happening, or that something has
15218
15309
  * finished.
15219
15310
  * @name DataTable#processing.dt