datatables.net 2.3.0 → 2.3.2

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.3.0
1
+ /*! DataTables 2.3.2
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -77,7 +77,7 @@ var DataTable = function ( selector, options )
77
77
  _fnCamelToHungarian( defaults.column, defaults.column, true );
78
78
 
79
79
  /* Setting up the initialisation object */
80
- _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ), true );
80
+ _fnCamelToHungarian( defaults, $.extend( oInit, _fnEscapeObject($this.data()) ), true );
81
81
 
82
82
 
83
83
 
@@ -507,6 +507,11 @@ DataTable.ext = _ext = {
507
507
  */
508
508
  errMode: "alert",
509
509
 
510
+ /** HTML entity escaping */
511
+ escape: {
512
+ /** When reading data-* attributes for initialisation options */
513
+ attributes: false
514
+ },
510
515
 
511
516
  /**
512
517
  * Legacy so v1 plug-ins don't throw js errors on load
@@ -1871,6 +1876,10 @@ function _fnCompatOpts ( init )
1871
1876
  init.orderIndicators = false;
1872
1877
  init.orderHandler = false;
1873
1878
  }
1879
+ else if (init.bSort === true) {
1880
+ init.orderIndicators = true;
1881
+ init.orderHandler = true;
1882
+ }
1874
1883
 
1875
1884
  // Which cells are the title cells?
1876
1885
  if (typeof init.bSortCellsTop === 'boolean') {
@@ -3538,7 +3547,9 @@ function _fnReDraw( settings, holdPosition, recompute )
3538
3547
 
3539
3548
  _fnDraw( settings );
3540
3549
 
3541
- settings._drawHold = false;
3550
+ settings.api.one('draw', function () {
3551
+ settings._drawHold = false;
3552
+ });
3542
3553
  }
3543
3554
 
3544
3555
 
@@ -3972,7 +3983,7 @@ function _fnDetectHeader ( settings, thead, write )
3972
3983
  if ( write ) {
3973
3984
  if (unique) {
3974
3985
  // Allow column options to be set from HTML attributes
3975
- _fnColumnOptions( settings, shifted, jqCell.data() );
3986
+ _fnColumnOptions( settings, shifted, _fnEscapeObject(jqCell.data()) );
3976
3987
 
3977
3988
  // Get the width for the column. This can be defined from the
3978
3989
  // width attribute, style attribute or `columns.width` option
@@ -4218,7 +4229,7 @@ function _fnBuildAjax( oSettings, data, fn )
4218
4229
  // to the object for the callback.
4219
4230
  var empty = {};
4220
4231
 
4221
- DataTable.util.set(ajax.dataSrc)(empty, []);
4232
+ _fnAjaxDataSrc(oSettings, empty, []);
4222
4233
  callback(empty);
4223
4234
  }
4224
4235
  else {
@@ -5746,9 +5757,11 @@ function _fnSortAttachListener(settings, node, selector, column, callback) {
5746
5757
  var run = false;
5747
5758
  var columns = column === undefined
5748
5759
  ? _fnColumnsFromHeader( e.target )
5749
- : Array.isArray(column)
5750
- ? column
5751
- : [column];
5760
+ : typeof column === 'function'
5761
+ ? column()
5762
+ : Array.isArray(column)
5763
+ ? column
5764
+ : [column];
5752
5765
 
5753
5766
  if ( columns.length ) {
5754
5767
  for ( var i=0, ien=columns.length ; i<ien ; i++ ) {
@@ -6813,6 +6826,19 @@ function _fnListener(that, name, src) {
6813
6826
  }
6814
6827
  }
6815
6828
 
6829
+ /**
6830
+ * Escape HTML entities in strings, in an object
6831
+ */
6832
+ function _fnEscapeObject(obj) {
6833
+ if (DataTable.ext.escape.attributes) {
6834
+ $.each(obj, function (key, val) {
6835
+ obj[key] = _escapeHtml(val);
6836
+ })
6837
+ }
6838
+
6839
+ return obj;
6840
+ }
6841
+
6816
6842
 
6817
6843
 
6818
6844
  /**
@@ -10158,7 +10184,7 @@ function cleanHeader(node, className) {
10158
10184
  * @type string
10159
10185
  * @default Version number
10160
10186
  */
10161
- DataTable.version = "2.3.0";
10187
+ DataTable.version = "2.3.2";
10162
10188
 
10163
10189
  /**
10164
10190
  * Private data store, containing all of the settings objects that are
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.3.0",
7
+ "version": "2.3.2",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -1633,7 +1633,11 @@ export interface ApiOrder {
1633
1633
  * @param callback Callback function
1634
1634
  * @returns DataTables API instance with the current order in the result set
1635
1635
  */
1636
- listener(node: string | Node | JQuery, column: number, callback: (() => void)): Api<any>;
1636
+ listener(
1637
+ node: string | Node | JQuery,
1638
+ column: HTMLElement | number | number[] | (() => number[]),
1639
+ callback: (() => void)
1640
+ ): Api<any>;
1637
1641
  }
1638
1642
 
1639
1643
  export interface ApiState<T> {
@@ -3152,6 +3156,9 @@ export interface DataTablesStaticExt {
3152
3156
  ccContent: IColumnControlContent;
3153
3157
  classes: ExtClassesSettings;
3154
3158
  errMode: string;
3159
+ escape: {
3160
+ attributes: boolean;
3161
+ };
3155
3162
  feature: any[];
3156
3163
  iApiIndex: number;
3157
3164
  internal: object;
@@ -3405,7 +3412,7 @@ type FunctionPreDrawCallback = (this: JQueryDataTables, settings: InternalSettin
3405
3412
 
3406
3413
  type FunctionRowCallback = (this: JQueryDataTables, row: HTMLTableRowElement, data: any[] | object, index: number) => void;
3407
3414
 
3408
- type FunctionStateLoadCallback = (this: JQueryDataTables, settings: InternalSettings, callback: ((state) => void)) => void | object;
3415
+ type FunctionStateLoadCallback = (this: JQueryDataTables, settings: InternalSettings, callback: ((state: State) => void)) => void | object;
3409
3416
 
3410
3417
  type FunctionStateLoaded = (this: JQueryDataTables, settings: InternalSettings, data: object) => void;
3411
3418