datatables.net 1.13.3 → 1.13.5

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,11 +1,11 @@
1
- /*! DataTables 1.13.3
1
+ /*! DataTables 1.13.5
2
2
  * ©2008-2023 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.13.3
8
+ * @version 1.13.4
9
9
  * @author SpryMedia Ltd
10
10
  * @contact www.datatables.net
11
11
  * @copyright SpryMedia Ltd.
@@ -34,21 +34,28 @@
34
34
  }
35
35
  else if ( typeof exports === 'object' ) {
36
36
  // CommonJS
37
- module.exports = function (root, $) {
38
- if ( ! root ) {
39
- // CommonJS environments without a window global must pass a
40
- // root. This will give an error otherwise
41
- root = window;
42
- }
37
+ // jQuery's factory checks for a global window - if it isn't present then it
38
+ // returns a factory function that expects the window object
39
+ var jq = require('jquery');
43
40
 
44
- if ( ! $ ) {
45
- $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
46
- require('jquery') :
47
- require('jquery')( root );
48
- }
41
+ if (typeof window !== 'undefined') {
42
+ module.exports = function (root, $) {
43
+ if ( ! root ) {
44
+ // CommonJS environments without a window global must pass a
45
+ // root. This will give an error otherwise
46
+ root = window;
47
+ }
49
48
 
50
- return factory( $, root, root.document );
51
- };
49
+ if ( ! $ ) {
50
+ $ = jq( root );
51
+ }
52
+
53
+ return factory( $, root, root.document );
54
+ };
55
+ }
56
+ else {
57
+ return factory( jq, window, window.document );
58
+ }
52
59
  }
53
60
  else {
54
61
  // Browser
@@ -61,6 +68,12 @@
61
68
 
62
69
  var DataTable = function ( selector, options )
63
70
  {
71
+ // Check if called with a window or jQuery object for DOM less applications
72
+ // This is for backwards compatibility
73
+ if (DataTable.factory(selector, options)) {
74
+ return DataTable;
75
+ }
76
+
64
77
  // When creating with `new`, create a new DataTable, returning the API instance
65
78
  if (this instanceof DataTable) {
66
79
  return $(selector).DataTable(options);
@@ -1165,6 +1178,7 @@
1165
1178
  type: sort !== null ? i+'.@data-'+sort : undefined,
1166
1179
  filter: filter !== null ? i+'.@data-'+filter : undefined
1167
1180
  };
1181
+ col._isArrayHost = true;
1168
1182
 
1169
1183
  _fnColumnOptions( oSettings, i );
1170
1184
  }
@@ -1370,7 +1384,7 @@
1370
1384
 
1371
1385
 
1372
1386
  var _isNumber = function ( d, decimalPoint, formatted ) {
1373
- let type = typeof d;
1387
+ var type = typeof d;
1374
1388
  var strType = type === 'string';
1375
1389
 
1376
1390
  if ( type === 'number' || type === 'bigint') {
@@ -1504,7 +1518,9 @@
1504
1518
 
1505
1519
 
1506
1520
  var _stripHtml = function ( d ) {
1507
- return d.replace( _re_html, '' );
1521
+ return d
1522
+ .replace( _re_html, '' ) // Complete tags
1523
+ .replace(/<script/i, ''); // Safety for incomplete script tag
1508
1524
  };
1509
1525
 
1510
1526
 
@@ -1878,7 +1894,10 @@
1878
1894
  continue;
1879
1895
  }
1880
1896
 
1881
- if ( data === null || data[ a[i] ] === undefined ) {
1897
+ if (data === null || data[ a[i] ] === null) {
1898
+ return null;
1899
+ }
1900
+ else if ( data === undefined || data[ a[i] ] === undefined ) {
1882
1901
  return undefined;
1883
1902
  }
1884
1903
 
@@ -2353,7 +2372,7 @@
2353
2372
 
2354
2373
  // Indicate if DataTables should read DOM data as an object or array
2355
2374
  // Used in _fnGetRowElements
2356
- if ( typeof mDataSrc !== 'number' ) {
2375
+ if ( typeof mDataSrc !== 'number' && ! oCol._isArrayHost ) {
2357
2376
  oSettings._rowReadObject = true;
2358
2377
  }
2359
2378
 
@@ -4049,11 +4068,16 @@
4049
4068
  settings.iDraw++;
4050
4069
  _fnProcessingDisplay( settings, true );
4051
4070
 
4071
+ // Keep track of drawHold state to handle scrolling after the Ajax call
4072
+ var drawHold = settings._drawHold;
4073
+
4052
4074
  _fnBuildAjax(
4053
4075
  settings,
4054
4076
  _fnAjaxParameters( settings ),
4055
4077
  function(json) {
4078
+ settings._drawHold = drawHold;
4056
4079
  _fnAjaxUpdateDraw( settings, json );
4080
+ settings._drawHold = false;
4057
4081
  }
4058
4082
  );
4059
4083
  }
@@ -4317,7 +4341,7 @@
4317
4341
  _fnThrottle( searchFn, searchDelay ) :
4318
4342
  searchFn
4319
4343
  )
4320
- .on( 'mouseup', function(e) {
4344
+ .on( 'mouseup.DT', function(e) {
4321
4345
  // Edge fix! Edge 17 does not trigger anything other than mouse events when clicking
4322
4346
  // on the clear icon (Edge bug 17584515). This is safe in other browsers as `searchFn`
4323
4347
  // checks the value to see if it has changed. In other browsers it won't have.
@@ -4383,7 +4407,7 @@
4383
4407
  if ( _fnDataSource( oSettings ) != 'ssp' )
4384
4408
  {
4385
4409
  /* Global filter */
4386
- _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive, oInput.return );
4410
+ _fnFilter( oSettings, oInput.sSearch, iForce, fnRegex(oInput), oInput.bSmart, oInput.bCaseInsensitive );
4387
4411
  fnSaveFilter( oInput );
4388
4412
 
4389
4413
  /* Now do the individual column filter */
@@ -4552,11 +4576,15 @@
4552
4576
  *
4553
4577
  * ^(?=.*?\bone\b)(?=.*?\btwo three\b)(?=.*?\bfour\b).*$
4554
4578
  */
4555
- var a = $.map( search.match( /"[^"]+"|[^ ]+/g ) || [''], function ( word ) {
4579
+ var a = $.map( search.match( /["\u201C][^"\u201D]+["\u201D]|[^ ]+/g ) || [''], function ( word ) {
4556
4580
  if ( word.charAt(0) === '"' ) {
4557
4581
  var m = word.match( /^"(.*)"$/ );
4558
4582
  word = m ? m[1] : word;
4559
4583
  }
4584
+ else if ( word.charAt(0) === '\u201C' ) {
4585
+ var m = word.match( /^\u201C(.*)\u201D$/ );
4586
+ word = m ? m[1] : word;
4587
+ }
4560
4588
 
4561
4589
  return word.replace('"', '');
4562
4590
  } );
@@ -9356,6 +9384,52 @@
9356
9384
 
9357
9385
 
9358
9386
 
9387
+ /**
9388
+ * Set the jQuery or window object to be used by DataTables
9389
+ *
9390
+ * @param {*} module Library / container object
9391
+ * @param {string} [type] Library or container type `lib`, `win` or `datetime`.
9392
+ * If not provided, automatic detection is attempted.
9393
+ */
9394
+ DataTable.use = function (module, type) {
9395
+ if (type === 'lib' || module.fn) {
9396
+ $ = module;
9397
+ }
9398
+ else if (type == 'win' || module.document) {
9399
+ window = module;
9400
+ document = module.document;
9401
+ }
9402
+ else if (type === 'datetime' || module.type === 'DateTime') {
9403
+ DataTable.DateTime = module;
9404
+ }
9405
+ }
9406
+
9407
+ /**
9408
+ * CommonJS factory function pass through. This will check if the arguments
9409
+ * given are a window object or a jQuery object. If so they are set
9410
+ * accordingly.
9411
+ * @param {*} root Window
9412
+ * @param {*} jq jQUery
9413
+ * @returns {boolean} Indicator
9414
+ */
9415
+ DataTable.factory = function (root, jq) {
9416
+ var is = false;
9417
+
9418
+ // Test if the first parameter is a window object
9419
+ if (root && root.document) {
9420
+ window = root;
9421
+ document = root.document;
9422
+ }
9423
+
9424
+ // Test if the second parameter is a jQuery object
9425
+ if (jq && jq.fn && jq.fn.jquery) {
9426
+ $ = jq;
9427
+ is = true;
9428
+ }
9429
+
9430
+ return is;
9431
+ }
9432
+
9359
9433
  /**
9360
9434
  * Provide a common method for plug-ins to check the version of DataTables being
9361
9435
  * used, in order to ensure compatibility.
@@ -9687,7 +9761,9 @@
9687
9761
  resolved._;
9688
9762
  }
9689
9763
 
9690
- return resolved.replace( '%d', plural ); // nb: plural might be undefined,
9764
+ return typeof resolved === 'string'
9765
+ ? resolved.replace( '%d', plural ) // nb: plural might be undefined,
9766
+ : resolved;
9691
9767
  } );
9692
9768
  /**
9693
9769
  * Version string for plug-ins to check compatibility. Allowed format is
@@ -9697,7 +9773,7 @@
9697
9773
  * @type string
9698
9774
  * @default Version number
9699
9775
  */
9700
- DataTable.version = "1.13.3";
9776
+ DataTable.version = "1.13.5";
9701
9777
 
9702
9778
  /**
9703
9779
  * Private data store, containing all of the settings objects that are
@@ -14839,7 +14915,7 @@
14839
14915
  'aria-controls': settings.sTableId,
14840
14916
  'aria-disabled': disabled ? 'true' : null,
14841
14917
  'aria-label': aria[ button ],
14842
- 'aria-role': 'link',
14918
+ 'role': 'link',
14843
14919
  'aria-current': btnClass === classes.sPageButtonActive ? 'page' : null,
14844
14920
  'data-dt-idx': button,
14845
14921
  'tabindex': tabIndex,
@@ -14973,7 +15049,7 @@
14973
15049
  return -Infinity;
14974
15050
  }
14975
15051
 
14976
- let type = typeof d;
15052
+ var type = typeof d;
14977
15053
 
14978
15054
  if (type === 'number' || type === 'bigint') {
14979
15055
  return d;
@@ -15347,7 +15423,7 @@
15347
15423
  var __thousands = ',';
15348
15424
  var __decimal = '.';
15349
15425
 
15350
- if (Intl) {
15426
+ if (window.Intl !== undefined) {
15351
15427
  try {
15352
15428
  var num = new Intl.NumberFormat().formatToParts(100000.1);
15353
15429