datatables.net 1.10.20 → 1.10.24

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.20
2
- * ©2008-2019 SpryMedia Ltd - datatables.net/license
1
+ /*! DataTables 1.10.24
2
+ * ©2008-2021 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.20
8
+ * @version 1.10.24
9
9
  * @file jquery.dataTables.js
10
10
  * @author SpryMedia Ltd
11
11
  * @contact www.datatables.net
12
- * @copyright Copyright 2008-2019 SpryMedia Ltd.
12
+ * @copyright Copyright 2008-2021 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
 
@@ -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
  }
@@ -1088,6 +1088,8 @@
1088
1088
  _fnLanguageCompat( json );
1089
1089
  _fnCamelToHungarian( defaults.oLanguage, json );
1090
1090
  $.extend( true, oLanguage, json );
1091
+
1092
+ _fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
1091
1093
  _fnInitialise( oSettings );
1092
1094
  },
1093
1095
  error: function () {
@@ -1097,6 +1099,9 @@
1097
1099
  } );
1098
1100
  bInitHandedOff = true;
1099
1101
  }
1102
+ else {
1103
+ _fnCallbackFire( oSettings, null, 'i18n', [oSettings]);
1104
+ }
1100
1105
 
1101
1106
  /*
1102
1107
  * Stripes
@@ -1356,7 +1361,7 @@
1356
1361
  // - Ƀ - Bitcoin
1357
1362
  // - Ξ - Ethereum
1358
1363
  // standards as thousands separators.
1359
- var _re_formatted_numeric = /[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;
1364
+ var _re_formatted_numeric = /['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi;
1360
1365
 
1361
1366
 
1362
1367
  var _empty = function ( d ) {
@@ -1584,6 +1589,36 @@
1584
1589
  return out;
1585
1590
  };
1586
1591
 
1592
+ // Surprisingly this is faster than [].concat.apply
1593
+ // https://jsperf.com/flatten-an-array-loop-vs-reduce/2
1594
+ var _flatten = function (out, val) {
1595
+ if (Array.isArray(val)) {
1596
+ for (var i=0 ; i<val.length ; i++) {
1597
+ _flatten(out, val[i]);
1598
+ }
1599
+ }
1600
+ else {
1601
+ out.push(val);
1602
+ }
1603
+
1604
+ return out;
1605
+ }
1606
+
1607
+ // Array.isArray polyfill.
1608
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
1609
+ if (! Array.isArray) {
1610
+ Array.isArray = function(arg) {
1611
+ return Object.prototype.toString.call(arg) === '[object Array]';
1612
+ };
1613
+ }
1614
+
1615
+ // .trim() polyfill
1616
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
1617
+ if (!String.prototype.trim) {
1618
+ String.prototype.trim = function () {
1619
+ return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
1620
+ };
1621
+ }
1587
1622
 
1588
1623
  /**
1589
1624
  * DataTables utility methods
@@ -1841,7 +1876,7 @@
1841
1876
 
1842
1877
  // orderData can be given as an integer
1843
1878
  var dataSort = init.aDataSort;
1844
- if ( typeof dataSort === 'number' && ! $.isArray( dataSort ) ) {
1879
+ if ( typeof dataSort === 'number' && ! Array.isArray( dataSort ) ) {
1845
1880
  init.aDataSort = [ dataSort ];
1846
1881
  }
1847
1882
  }
@@ -2325,7 +2360,7 @@
2325
2360
  def.targets :
2326
2361
  def.aTargets;
2327
2362
 
2328
- if ( ! $.isArray( aTargets ) )
2363
+ if ( ! Array.isArray( aTargets ) )
2329
2364
  {
2330
2365
  aTargets = [ aTargets ];
2331
2366
  }
@@ -2644,7 +2679,7 @@
2644
2679
  innerSrc = a.join('.');
2645
2680
 
2646
2681
  // Traverse each entry in the array getting the properties requested
2647
- if ( $.isArray( data ) ) {
2682
+ if ( Array.isArray( data ) ) {
2648
2683
  for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
2649
2684
  out.push( fetchData( data[j], type, innerSrc ) );
2650
2685
  }
@@ -2732,6 +2767,11 @@
2732
2767
 
2733
2768
  for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
2734
2769
  {
2770
+ // Protect against prototype pollution
2771
+ if (a[i] === '__proto__' || a[i] === 'constructor') {
2772
+ throw new Error('Cannot set prototype values');
2773
+ }
2774
+
2735
2775
  // Check if we are dealing with an array notation request
2736
2776
  arrayNotation = a[i].match(__reArray);
2737
2777
  funcNotation = a[i].match(__reFn);
@@ -2747,7 +2787,7 @@
2747
2787
  innerSrc = b.join('.');
2748
2788
 
2749
2789
  // Traverse each entry in the array setting the properties requested
2750
- if ( $.isArray( val ) )
2790
+ if ( Array.isArray( val ) )
2751
2791
  {
2752
2792
  for ( var j=0, jLen=val.length ; j<jLen ; j++ )
2753
2793
  {
@@ -2994,7 +3034,7 @@
2994
3034
  var cellProcess = function ( cell ) {
2995
3035
  if ( colIdx === undefined || colIdx === i ) {
2996
3036
  col = columns[i];
2997
- contents = $.trim(cell.innerHTML);
3037
+ contents = (cell.innerHTML).trim();
2998
3038
 
2999
3039
  if ( col && col._bAttrSrc ) {
3000
3040
  var setter = _fnSetObjectDataFn( col.mData._ );
@@ -3110,7 +3150,7 @@
3110
3150
  cells.push( nTd );
3111
3151
 
3112
3152
  // Need to create the HTML if new, or if a rendering function is defined
3113
- if ( create || ((!nTrIn || oCol.mRender || oCol.mData !== i) &&
3153
+ if ( create || ((oCol.mRender || oCol.mData !== i) &&
3114
3154
  (!$.isPlainObject(oCol.mData) || oCol.mData._ !== i+'.display')
3115
3155
  )) {
3116
3156
  nTd.innerHTML = _fnGetCellData( oSettings, iRow, i, 'display' );
@@ -3142,10 +3182,6 @@
3142
3182
 
3143
3183
  _fnCallbackFire( oSettings, 'aoRowCreatedCallback', null, [nTr, rowData, iRow, cells] );
3144
3184
  }
3145
-
3146
- // Remove once webkit bug 131819 and Chromium bug 365619 have been resolved
3147
- // and deployed
3148
- row.nTr.setAttribute( 'role', 'row' );
3149
3185
  }
3150
3186
 
3151
3187
 
@@ -3244,11 +3280,11 @@
3244
3280
  }
3245
3281
 
3246
3282
  /* ARIA role for the rows */
3247
- $(thead).find('>tr').attr('role', 'row');
3283
+ $(thead).children('tr').attr('role', 'row');
3248
3284
 
3249
3285
  /* Deal with the footer - add classes if required */
3250
- $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH );
3251
- $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH );
3286
+ $(thead).children('tr').children('th, td').addClass( classes.sHeaderTH );
3287
+ $(tfoot).children('tr').children('th, td').addClass( classes.sFooterTH );
3252
3288
 
3253
3289
  // Cache the footer cells. Note that we only take the cells from the first
3254
3290
  // row in the footer. If there is more than one row the user wants to
@@ -3834,7 +3870,7 @@
3834
3870
 
3835
3871
  // Convert to object based for 1.10+ if using the old array scheme which can
3836
3872
  // come from server-side processing or serverParams
3837
- if ( data && $.isArray(data) ) {
3873
+ if ( data && Array.isArray(data) ) {
3838
3874
  var tmp = {};
3839
3875
  var rbracket = /(.*?)\[\]$/;
3840
3876
 
@@ -4112,7 +4148,7 @@
4112
4148
  var recordsTotal = compat( 'iTotalRecords', 'recordsTotal' );
4113
4149
  var recordsFiltered = compat( 'iTotalDisplayRecords', 'recordsFiltered' );
4114
4150
 
4115
- if ( draw ) {
4151
+ if ( draw !== undefined ) {
4116
4152
  // Protect against out of sequence returns
4117
4153
  if ( draw*1 < settings.iDraw ) {
4118
4154
  return;
@@ -4227,6 +4263,14 @@
4227
4263
  _fnThrottle( searchFn, searchDelay ) :
4228
4264
  searchFn
4229
4265
  )
4266
+ .on( 'mouseup', function(e) {
4267
+ // Edge fix! Edge 17 does not trigger anything other than mouse events when clicking
4268
+ // on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
4269
+ // checks the value to see if it has changed. In other browsers it won't have.
4270
+ setTimeout( function () {
4271
+ searchFn.call(jqFilter[0]);
4272
+ }, 10);
4273
+ } )
4230
4274
  .on( 'keypress.DT', function(e) {
4231
4275
  /* Prevent form submission */
4232
4276
  if ( e.keyCode == 13 ) {
@@ -4811,7 +4855,7 @@
4811
4855
  classes = settings.oClasses,
4812
4856
  tableId = settings.sTableId,
4813
4857
  menu = settings.aLengthMenu,
4814
- d2 = $.isArray( menu[0] ),
4858
+ d2 = Array.isArray( menu[0] ),
4815
4859
  lengths = d2 ? menu[0] : menu,
4816
4860
  language = d2 ? menu[1] : menu;
4817
4861
 
@@ -5161,10 +5205,10 @@
5161
5205
  } );
5162
5206
  }
5163
5207
 
5164
- $(scrollBody).css(
5165
- scrollY && scroll.bCollapse ? 'max-height' : 'height',
5166
- scrollY
5167
- );
5208
+ $(scrollBody).css('max-height', scrollY);
5209
+ if (! scroll.bCollapse) {
5210
+ $(scrollBody).css('height', scrollY);
5211
+ }
5168
5212
 
5169
5213
  settings.nScrollHead = scrollHead;
5170
5214
  settings.nScrollBody = scrollBody;
@@ -5857,7 +5901,7 @@
5857
5901
  fixedObj = $.isPlainObject( fixed ),
5858
5902
  nestedSort = [],
5859
5903
  add = function ( a ) {
5860
- if ( a.length && ! $.isArray( a[0] ) ) {
5904
+ if ( a.length && ! Array.isArray( a[0] ) ) {
5861
5905
  // 1D array
5862
5906
  nestedSort.push( a );
5863
5907
  }
@@ -5869,7 +5913,7 @@
5869
5913
 
5870
5914
  // Build the sort array, with pre-fix and post-fix options if they have been
5871
5915
  // specified
5872
- if ( $.isArray( fixed ) ) {
5916
+ if ( Array.isArray( fixed ) ) {
5873
5917
  add( fixed );
5874
5918
  }
5875
5919
 
@@ -6498,9 +6542,9 @@
6498
6542
  */
6499
6543
  function _fnMap( ret, src, name, mappedName )
6500
6544
  {
6501
- if ( $.isArray( name ) ) {
6545
+ if ( Array.isArray( name ) ) {
6502
6546
  $.each( name, function (i, val) {
6503
- if ( $.isArray( val ) ) {
6547
+ if ( Array.isArray( val ) ) {
6504
6548
  _fnMap( ret, src, val[0], val[1] );
6505
6549
  }
6506
6550
  else {
@@ -6552,7 +6596,7 @@
6552
6596
  }
6553
6597
  $.extend( true, out[prop], val );
6554
6598
  }
6555
- else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && $.isArray(val) ) {
6599
+ else if ( breakRefs && prop !== 'data' && prop !== 'aaData' && Array.isArray(val) ) {
6556
6600
  out[prop] = val.slice();
6557
6601
  }
6558
6602
  else {
@@ -6578,7 +6622,7 @@
6578
6622
  {
6579
6623
  $(n)
6580
6624
  .on( 'click.DT', oData, function (e) {
6581
- $(n).blur(); // Remove focus outline for mouse users
6625
+ $(n).trigger('blur'); // Remove focus outline for mouse users
6582
6626
  fn(e);
6583
6627
  } )
6584
6628
  .on( 'keypress.DT', oData, function (e){
@@ -6896,7 +6940,7 @@
6896
6940
  }
6897
6941
  };
6898
6942
 
6899
- if ( $.isArray( context ) ) {
6943
+ if ( Array.isArray( context ) ) {
6900
6944
  for ( var i=0, ien=context.length ; i<ien ; i++ ) {
6901
6945
  ctxSettings( context[i] );
6902
6946
  }
@@ -7254,7 +7298,7 @@
7254
7298
 
7255
7299
  _Api.register = _api_register = function ( name, val )
7256
7300
  {
7257
- if ( $.isArray( name ) ) {
7301
+ if ( Array.isArray( name ) ) {
7258
7302
  for ( var j=0, jen=name.length ; j<jen ; j++ ) {
7259
7303
  _Api.register( name[j], val );
7260
7304
  }
@@ -7324,7 +7368,7 @@
7324
7368
  // New API instance returned, want the value from the first item
7325
7369
  // in the returned array for the singular result.
7326
7370
  return ret.length ?
7327
- $.isArray( ret[0] ) ?
7371
+ Array.isArray( ret[0] ) ?
7328
7372
  new _Api( ret.context, ret[0] ) : // Array results are 'enhanced'
7329
7373
  ret[0] :
7330
7374
  undefined;
@@ -7347,6 +7391,12 @@
7347
7391
  */
7348
7392
  var __table_selector = function ( selector, a )
7349
7393
  {
7394
+ if ( Array.isArray(selector) ) {
7395
+ return $.map( selector, function (item) {
7396
+ return __table_selector(item, a);
7397
+ } );
7398
+ }
7399
+
7350
7400
  // Integer is used to pick out a table by index
7351
7401
  if ( typeof selector === 'number' ) {
7352
7402
  return [ a[ selector ] ];
@@ -7382,7 +7432,7 @@
7382
7432
  */
7383
7433
  _api_register( 'tables()', function ( selector ) {
7384
7434
  // A new instance is created if there was a selector specified
7385
- return selector ?
7435
+ return selector !== undefined && selector !== null ?
7386
7436
  new _Api( __table_selector( selector, this.context ) ) :
7387
7437
  this;
7388
7438
  } );
@@ -7730,7 +7780,7 @@
7730
7780
  [ selector[i] ];
7731
7781
 
7732
7782
  for ( j=0, jen=a.length ; j<jen ; j++ ) {
7733
- res = selectFn( typeof a[j] === 'string' ? $.trim(a[j]) : a[j] );
7783
+ res = selectFn( typeof a[j] === 'string' ? (a[j]).trim() : a[j] );
7734
7784
 
7735
7785
  if ( res && res.length ) {
7736
7786
  out = out.concat( res );
@@ -8156,7 +8206,7 @@
8156
8206
  row._aData = data;
8157
8207
 
8158
8208
  // If the DOM has an id, and the data source is an array
8159
- if ( $.isArray( data ) && row.nTr.id ) {
8209
+ if ( Array.isArray( data ) && row.nTr && row.nTr.id ) {
8160
8210
  _fnSetObjectDataFn( ctx[0].rowId )( data, row.nTr.id );
8161
8211
  }
8162
8212
 
@@ -8202,7 +8252,7 @@
8202
8252
  var rows = [];
8203
8253
  var addRow = function ( r, k ) {
8204
8254
  // Recursion to allow for arrays of jQuery objects
8205
- if ( $.isArray( r ) || r instanceof $ ) {
8255
+ if ( Array.isArray( r ) || r instanceof $ ) {
8206
8256
  for ( var i=0, ien=r.length ; i<ien ; i++ ) {
8207
8257
  addRow( r[i], k );
8208
8258
  }
@@ -8216,7 +8266,7 @@
8216
8266
  }
8217
8267
  else {
8218
8268
  // Otherwise create a row with a wrapper
8219
- var created = $('<tr><td/></tr>').addClass( k );
8269
+ var created = $('<tr><td></td></tr>').addClass( k );
8220
8270
  $('td', created)
8221
8271
  .addClass( k )
8222
8272
  .html( r )
@@ -8712,14 +8762,12 @@
8712
8762
  return _selector_first( this.columns( selector, opts ) );
8713
8763
  } );
8714
8764
 
8715
-
8716
-
8717
8765
  var __cell_selector = function ( settings, selector, opts )
8718
8766
  {
8719
8767
  var data = settings.aoData;
8720
8768
  var rows = _selector_row_indexes( settings, opts );
8721
8769
  var cells = _removeEmpty( _pluck_order( data, rows, 'anCells' ) );
8722
- var allCells = $( [].concat.apply([], cells) );
8770
+ var allCells = $(_flatten( [], cells ));
8723
8771
  var row;
8724
8772
  var columns = settings.aoColumns.length;
8725
8773
  var a, i, ien, j, o, host;
@@ -8991,7 +9039,7 @@
8991
9039
  // Simple column / direction passed in
8992
9040
  order = [ [ order, dir ] ];
8993
9041
  }
8994
- else if ( order.length && ! $.isArray( order[0] ) ) {
9042
+ else if ( order.length && ! Array.isArray( order[0] ) ) {
8995
9043
  // Arguments passed in (list of 1D arrays)
8996
9044
  order = Array.prototype.slice.call( arguments );
8997
9045
  }
@@ -9027,7 +9075,7 @@
9027
9075
  ctx[0].aaSortingFixed :
9028
9076
  undefined;
9029
9077
 
9030
- return $.isArray( fixed ) ?
9078
+ return Array.isArray( fixed ) ?
9031
9079
  { pre: fixed } :
9032
9080
  fixed;
9033
9081
  }
@@ -9487,7 +9535,7 @@
9487
9535
  * @type string
9488
9536
  * @default Version number
9489
9537
  */
9490
- DataTable.version = "1.10.20";
9538
+ DataTable.version = "1.10.24";
9491
9539
 
9492
9540
  /**
9493
9541
  * Private data store, containing all of the settings objects that are
@@ -9905,8 +9953,8 @@
9905
9953
  * version is still, internally the primary interface, but is is not documented
9906
9954
  * - hence the @name tags in each doc comment. This allows a Javascript function
9907
9955
  * to create a map from Hungarian notation to camel case (going the other direction
9908
- * would require each property to be listed, which would at around 3K to the size
9909
- * of DataTables, while this method is about a 0.5K hit.
9956
+ * would require each property to be listed, which would add around 3K to the size
9957
+ * of DataTables, while this method is about a 0.5K hit).
9910
9958
  *
9911
9959
  * Ultimately this does pave the way for Hungarian notation to be dropped
9912
9960
  * completely, but that is a massive amount of work and will break current
@@ -11005,7 +11053,9 @@
11005
11053
  'DataTables_'+settings.sInstance+'_'+location.pathname
11006
11054
  )
11007
11055
  );
11008
- } catch (e) {}
11056
+ } catch (e) {
11057
+ return {};
11058
+ }
11009
11059
  },
11010
11060
 
11011
11061
 
@@ -14437,8 +14487,8 @@
14437
14487
  "sSortAsc": "sorting_asc",
14438
14488
  "sSortDesc": "sorting_desc",
14439
14489
  "sSortable": "sorting", /* Sortable in both directions */
14440
- "sSortableAsc": "sorting_asc_disabled",
14441
- "sSortableDesc": "sorting_desc_disabled",
14490
+ "sSortableAsc": "sorting_desc_disabled",
14491
+ "sSortableDesc": "sorting_asc_disabled",
14442
14492
  "sSortableNone": "sorting_disabled",
14443
14493
  "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */
14444
14494
 
@@ -14559,7 +14609,7 @@
14559
14609
  for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
14560
14610
  button = buttons[i];
14561
14611
 
14562
- if ( $.isArray( button ) ) {
14612
+ if ( Array.isArray( button ) ) {
14563
14613
  var inner = $( '<'+(button.DT_el || 'div')+'/>' )
14564
14614
  .appendTo( container );
14565
14615
  attach( inner, button );
@@ -14595,7 +14645,7 @@
14595
14645
  case 'next':
14596
14646
  btnDisplay = lang.sNext;
14597
14647
 
14598
- if ( page === pages-1 ) {
14648
+ if ( pages === 0 || page === pages-1 ) {
14599
14649
  tabIndex = -1;
14600
14650
  btnClass += ' ' + disabledClass;
14601
14651
  }
@@ -14604,14 +14654,14 @@
14604
14654
  case 'last':
14605
14655
  btnDisplay = lang.sLast;
14606
14656
 
14607
- if ( page === pages-1 ) {
14657
+ if ( pages === 0 || page === pages-1 ) {
14608
14658
  tabIndex = -1;
14609
14659
  btnClass += ' ' + disabledClass;
14610
14660
  }
14611
14661
  break;
14612
14662
 
14613
14663
  default:
14614
- btnDisplay = button + 1;
14664
+ btnDisplay = settings.fnFormatNumber( button + 1 );
14615
14665
  btnClass = page === button ?
14616
14666
  classes.sPageButtonActive : '';
14617
14667
  break;
@@ -14658,7 +14708,7 @@
14658
14708
  attach( $(host).empty(), buttons );
14659
14709
 
14660
14710
  if ( activeEl !== undefined ) {
14661
- $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
14711
+ $(host).find( '[data-dt-idx='+activeEl+']' ).trigger('focus');
14662
14712
  }
14663
14713
  }
14664
14714
  }
@@ -14879,7 +14929,6 @@
14879
14929
 
14880
14930
  cell
14881
14931
  .removeClass(
14882
- column.sSortingClass +' '+
14883
14932
  classes.sSortAsc +' '+
14884
14933
  classes.sSortDesc
14885
14934
  )
@@ -14944,7 +14993,11 @@
14944
14993
 
14945
14994
  var __htmlEscapeEntities = function ( d ) {
14946
14995
  return typeof d === 'string' ?
14947
- 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;') :
14948
15001
  d;
14949
15002
  };
14950
15003