mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-19 12:52:11 +01:00
Fix: Couple of trivial optimisations for speed and size
This commit is contained in:
parent
cfb77fd569
commit
91c8547f48
22
media/js/jquery.dataTables.js
vendored
22
media/js/jquery.dataTables.js
vendored
@ -2610,22 +2610,21 @@
|
|||||||
var sName = 'name="'+oSettings.sTableId+'_length"';
|
var sName = 'name="'+oSettings.sTableId+'_length"';
|
||||||
var sStdMenu = '<select size="1" '+sName+'>';
|
var sStdMenu = '<select size="1" '+sName+'>';
|
||||||
var i, iLen;
|
var i, iLen;
|
||||||
|
var aLengthMenu = oSettings.aLengthMenu;
|
||||||
|
|
||||||
if ( oSettings.aLengthMenu.length == 2 && typeof oSettings.aLengthMenu[0] === 'object' &&
|
if ( aLengthMenu.length == 2 && typeof aLengthMenu[0] === 'object' &&
|
||||||
typeof oSettings.aLengthMenu[1] === 'object' )
|
typeof aLengthMenu[1] === 'object' )
|
||||||
{
|
{
|
||||||
for ( i=0, iLen=oSettings.aLengthMenu[0].length ; i<iLen ; i++ )
|
for ( i=0, iLen=aLengthMenu[0].length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
sStdMenu += '<option value="'+oSettings.aLengthMenu[0][i]+'">'+
|
sStdMenu += '<option value="'+aLengthMenu[0][i]+'">'+aLengthMenu[1][i]+'</option>';
|
||||||
oSettings.aLengthMenu[1][i]+'</option>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for ( i=0, iLen=oSettings.aLengthMenu.length ; i<iLen ; i++ )
|
for ( i=0, iLen=aLengthMenu.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
sStdMenu += '<option value="'+oSettings.aLengthMenu[i]+'">'+
|
sStdMenu += '<option value="'+aLengthMenu[i]+'">'+aLengthMenu[i]+'</option>';
|
||||||
oSettings.aLengthMenu[i]+'</option>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sStdMenu += '</select>';
|
sStdMenu += '</select>';
|
||||||
@ -4452,11 +4451,12 @@
|
|||||||
function _fnGetTrNodes ( oSettings )
|
function _fnGetTrNodes ( oSettings )
|
||||||
{
|
{
|
||||||
var aNodes = [];
|
var aNodes = [];
|
||||||
for ( var i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
var aoData = oSettings.aoData;
|
||||||
|
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
if ( oSettings.aoData[i].nTr !== null )
|
if ( aoData[i].nTr !== null )
|
||||||
{
|
{
|
||||||
aNodes.push( oSettings.aoData[i].nTr );
|
aNodes.push( aoData[i].nTr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aNodes;
|
return aNodes;
|
||||||
|
@ -17,22 +17,21 @@ function _fnFeatureHtmlLength ( oSettings )
|
|||||||
var sName = 'name="'+oSettings.sTableId+'_length"';
|
var sName = 'name="'+oSettings.sTableId+'_length"';
|
||||||
var sStdMenu = '<select size="1" '+sName+'>';
|
var sStdMenu = '<select size="1" '+sName+'>';
|
||||||
var i, iLen;
|
var i, iLen;
|
||||||
|
var aLengthMenu = oSettings.aLengthMenu;
|
||||||
|
|
||||||
if ( oSettings.aLengthMenu.length == 2 && typeof oSettings.aLengthMenu[0] === 'object' &&
|
if ( aLengthMenu.length == 2 && typeof aLengthMenu[0] === 'object' &&
|
||||||
typeof oSettings.aLengthMenu[1] === 'object' )
|
typeof aLengthMenu[1] === 'object' )
|
||||||
{
|
{
|
||||||
for ( i=0, iLen=oSettings.aLengthMenu[0].length ; i<iLen ; i++ )
|
for ( i=0, iLen=aLengthMenu[0].length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
sStdMenu += '<option value="'+oSettings.aLengthMenu[0][i]+'">'+
|
sStdMenu += '<option value="'+aLengthMenu[0][i]+'">'+aLengthMenu[1][i]+'</option>';
|
||||||
oSettings.aLengthMenu[1][i]+'</option>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for ( i=0, iLen=oSettings.aLengthMenu.length ; i<iLen ; i++ )
|
for ( i=0, iLen=aLengthMenu.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
sStdMenu += '<option value="'+oSettings.aLengthMenu[i]+'">'+
|
sStdMenu += '<option value="'+aLengthMenu[i]+'">'+aLengthMenu[i]+'</option>';
|
||||||
oSettings.aLengthMenu[i]+'</option>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sStdMenu += '</select>';
|
sStdMenu += '</select>';
|
||||||
|
@ -29,11 +29,12 @@ function _fnSettingsFromNode ( nTable )
|
|||||||
function _fnGetTrNodes ( oSettings )
|
function _fnGetTrNodes ( oSettings )
|
||||||
{
|
{
|
||||||
var aNodes = [];
|
var aNodes = [];
|
||||||
for ( var i=0, iLen=oSettings.aoData.length ; i<iLen ; i++ )
|
var aoData = oSettings.aoData;
|
||||||
|
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
|
||||||
{
|
{
|
||||||
if ( oSettings.aoData[i].nTr !== null )
|
if ( aoData[i].nTr !== null )
|
||||||
{
|
{
|
||||||
aNodes.push( oSettings.aoData[i].nTr );
|
aNodes.push( aoData[i].nTr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aNodes;
|
return aNodes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user