datatables.net 2.3.1 → 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.1
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
@@ -3978,7 +3983,7 @@ function _fnDetectHeader ( settings, thead, write )
3978
3983
  if ( write ) {
3979
3984
  if (unique) {
3980
3985
  // Allow column options to be set from HTML attributes
3981
- _fnColumnOptions( settings, shifted, jqCell.data() );
3986
+ _fnColumnOptions( settings, shifted, _fnEscapeObject(jqCell.data()) );
3982
3987
 
3983
3988
  // Get the width for the column. This can be defined from the
3984
3989
  // width attribute, style attribute or `columns.width` option
@@ -4224,7 +4229,7 @@ function _fnBuildAjax( oSettings, data, fn )
4224
4229
  // to the object for the callback.
4225
4230
  var empty = {};
4226
4231
 
4227
- DataTable.util.set(ajax.dataSrc)(empty, []);
4232
+ _fnAjaxDataSrc(oSettings, empty, []);
4228
4233
  callback(empty);
4229
4234
  }
4230
4235
  else {
@@ -5752,9 +5757,11 @@ function _fnSortAttachListener(settings, node, selector, column, callback) {
5752
5757
  var run = false;
5753
5758
  var columns = column === undefined
5754
5759
  ? _fnColumnsFromHeader( e.target )
5755
- : Array.isArray(column)
5756
- ? column
5757
- : [column];
5760
+ : typeof column === 'function'
5761
+ ? column()
5762
+ : Array.isArray(column)
5763
+ ? column
5764
+ : [column];
5758
5765
 
5759
5766
  if ( columns.length ) {
5760
5767
  for ( var i=0, ien=columns.length ; i<ien ; i++ ) {
@@ -6819,6 +6826,19 @@ function _fnListener(that, name, src) {
6819
6826
  }
6820
6827
  }
6821
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
+
6822
6842
 
6823
6843
 
6824
6844
  /**
@@ -10164,7 +10184,7 @@ function cleanHeader(node, className) {
10164
10184
  * @type string
10165
10185
  * @default Version number
10166
10186
  */
10167
- DataTable.version = "2.3.1";
10187
+ DataTable.version = "2.3.2";
10168
10188
 
10169
10189
  /**
10170
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.1",
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;