1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-18 16:54:14 +01:00

Update media/src/core/core.sizing.js

Define nWrapper earlier to avoid calling dom to get the parentNode multiple times in the initial loop
This commit is contained in:
Tim Tucker 2012-09-03 13:11:11 -03:00
parent 59dc2aed9c
commit 4cbb9f3196

View File

@ -1,4 +1,3 @@
/**
* Convert a CSS unit width to pixels (e.g. 2em)
* @param {string} sWidth width to be converted
@ -45,6 +44,7 @@ function _fnCalculateColumnWidths ( oSettings )
var i, iIndex, iCorrector, iWidth;
var oHeaders = $('th', oSettings.nTHead);
var widthAttr = oSettings.nTable.getAttribute('width');
var nWrapper = oSettings.nTable.parentNode;
/* Convert any user input sizes into pixel sizes */
for ( i=0 ; i<iColums ; i++ )
@ -56,7 +56,7 @@ function _fnCalculateColumnWidths ( oSettings )
if ( oSettings.aoColumns[i].sWidth !== null )
{
iTmpWidth = _fnConvertToWidth( oSettings.aoColumns[i].sWidthOrig,
oSettings.nTable.parentNode );
nWrapper );
if ( iTmpWidth !== null )
{
oSettings.aoColumns[i].sWidth = _fnStringToCss( iTmpWidth );
@ -156,7 +156,6 @@ function _fnCalculateColumnWidths ( oSettings )
}
/* Build the table and 'display' it */
var nWrapper = oSettings.nTable.parentNode;
nWrapper.appendChild( nCalcTmp );
/* When scrolling (X or Y) we want to set the width of the table as appropriate. However,