1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-04-12 04:02:29 +02:00

Fix: In _fnExtend there was a bug where a variable referenced a 'locally global' (for lack of a better term) variable rather than the in function variable that it should be have. Got away with this since _fnExtend is only used for one thing at the moment, but it was wrong. Now fixed.

Update - Performance / Memory: The functions that DataTables uses are not instance based, they are locally scoped, but they were included in the DataTable constructore, which meant that every time you create a new 'instance' of DataTables ($().dataTable()) it would create these functions in that scope again and again. That's completely pointless since we only need them once, so moving them outside the constructor helps both performance and memory (not huge, but very little helps!).
This commit is contained in:
Allan Jardine 2012-10-07 18:02:38 +01:00
parent ec10497217
commit ab454c1c33
3 changed files with 4792 additions and 4794 deletions

View File

@ -145,41 +145,6 @@
}
/**
* DataTables is a plug-in for the jQuery Javascript library. It is a
* highly flexible tool, based upon the foundations of progressive
* enhancement, which will add advanced interaction controls to any
* HTML table. For a full list of features please refer to
* <a href="http://datatables.net">DataTables.net</a>.
*
* Note that the <i>DataTable</i> object is not a global variable but is
* aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
* it may be accessed.
*
* @class
* @param {object} [oInit={}] Configuration object for DataTables. Options
* are defined by {@link DataTable.defaults}
* @requires jQuery 1.3+
*
* @example
* // Basic initialisation
* $(document).ready( function {
* $('#example').dataTable();
* } );
*
* @example
* // Initialisation with configuration options - in this case, disable
* // pagination and sorting.
* $(document).ready( function {
* $('#example').dataTable( {
* "bPaginate": false,
* "bSort": false
* } );
* } );
*/
var DataTable = function( oInit )
{
/**
* Add a column to the list used for the table with default values
@ -4786,7 +4751,7 @@
{
val = oExtender[prop];
if ( typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false )
if ( typeof oExtender[prop] === 'object' && val !== null && $.isArray(val) === false )
{
$.extend( true, oOut[prop], val );
}
@ -4956,6 +4921,40 @@
}
/**
* DataTables is a plug-in for the jQuery Javascript library. It is a
* highly flexible tool, based upon the foundations of progressive
* enhancement, which will add advanced interaction controls to any
* HTML table. For a full list of features please refer to
* <a href="http://datatables.net">DataTables.net</a>.
*
* Note that the <i>DataTable</i> object is not a global variable but is
* aliased to <i>jQuery.fn.DataTable</i> and <i>jQuery.fn.dataTable</i> through which
* it may be accessed.
*
* @class
* @param {object} [oInit={}] Configuration object for DataTables. Options
* are defined by {@link DataTable.defaults}
* @requires jQuery 1.3+
*
* @example
* // Basic initialisation
* $(document).ready( function {
* $('#example').dataTable();
* } );
*
* @example
* // Initialisation with configuration options - in this case, disable
* // pagination and sorting.
* $(document).ready( function {
* $('#example').dataTable( {
* "bPaginate": false,
* "bSort": false
* } );
* } );
*/
var DataTable = function( oInit )
{
/**
* Perform a jQuery selector action on the table's TR elements (from the tbody) and
* return the resulting jQuery object.

View File

@ -45,6 +45,21 @@
"use strict";
require('core.compat.js');
require('core.columns.js');
require('core.data.js');
require('core.draw.js');
require('core.ajax.js');
require('core.filter.js');
require('core.info.js');
require('core.init.js');
require('core.length.js');
require('core.page.js');
require('core.processing.js');
require('core.scrolling.js');
require('core.sizing.js');
require('core.sort.js');
require('core.state.js');
require('core.support.js');
/**
* DataTables is a plug-in for the jQuery Javascript library. It is a
@ -80,22 +95,6 @@
*/
var DataTable = function( oInit )
{
require('core.columns.js');
require('core.data.js');
require('core.draw.js');
require('core.ajax.js');
require('core.filter.js');
require('core.info.js');
require('core.init.js');
require('core.length.js');
require('core.page.js');
require('core.processing.js');
require('core.scrolling.js');
require('core.sizing.js');
require('core.sort.js');
require('core.state.js');
require('core.support.js');
require('api.methods.js');
require('api.internal.js');

View File

@ -175,7 +175,7 @@ function _fnExtend( oOut, oExtender )
{
val = oExtender[prop];
if ( typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false )
if ( typeof oExtender[prop] === 'object' && val !== null && $.isArray(val) === false )
{
$.extend( true, oOut[prop], val );
}