1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-01-18 11:52:11 +01:00

Dev: Tidy up the way that the header and footer elements are 'got'. Based on pull request #92.

This commit is contained in:
Allan Jardine 2012-09-09 18:43:57 +01:00
parent df614240cf
commit 0a3793b4bb
2 changed files with 10 additions and 12 deletions

View File

@ -3224,11 +3224,15 @@
/* Clone the current header and footer elements and then place it into the inner table */
nTheadSize = $(o.nTHead).clone()[0];
o.nTable.insertBefore( nTheadSize, o.nTable.childNodes[0] );
anHeadToSize = o.nTHead.getElementsByTagName('tr');
anHeadSizers = nTheadSize.getElementsByTagName('tr');
if ( o.nTFoot !== null )
{
nTfootSize = $(o.nTFoot).clone()[0];
o.nTable.insertBefore( nTfootSize, o.nTable.childNodes[1] );
anFootToSize = o.nTFoot.getElementsByTagName('tr');
anFootSizers = nTfootSize.getElementsByTagName('tr');
}
/*
@ -3256,7 +3260,7 @@
{
_fnApplyToChildren( function(n) {
n.style.width = "";
}, nTfootSize.getElementsByTagName('tr') );
}, anFootSizers );
}
// If scroll collapse is enabled, when we put the headers back into the body for sizing, we
@ -3318,8 +3322,6 @@
/* We want the hidden header to have zero height, so remove padding and borders. Then
* set the width based on the real headers
*/
anHeadToSize = o.nTHead.getElementsByTagName('tr');
anHeadSizers = nTheadSize.getElementsByTagName('tr');
// Apply all styles in one pass. Invalidates layout only once because we don't read any
// DOM properties.
@ -3342,9 +3344,6 @@
/* Same again with the footer if we have one */
if ( o.nTFoot !== null )
{
anFootSizers = nTfootSize.getElementsByTagName('tr');
anFootToSize = o.nTFoot.getElementsByTagName('tr');
_fnApplyToChildren( zeroOut, anFootSizers );
_fnApplyToChildren( function(nSizer) {

View File

@ -212,11 +212,15 @@ function _fnScrollDraw ( o )
/* Clone the current header and footer elements and then place it into the inner table */
nTheadSize = $(o.nTHead).clone()[0];
o.nTable.insertBefore( nTheadSize, o.nTable.childNodes[0] );
anHeadToSize = o.nTHead.getElementsByTagName('tr');
anHeadSizers = nTheadSize.getElementsByTagName('tr');
if ( o.nTFoot !== null )
{
nTfootSize = $(o.nTFoot).clone()[0];
o.nTable.insertBefore( nTfootSize, o.nTable.childNodes[1] );
anFootToSize = o.nTFoot.getElementsByTagName('tr');
anFootSizers = nTfootSize.getElementsByTagName('tr');
}
/*
@ -244,7 +248,7 @@ function _fnScrollDraw ( o )
{
_fnApplyToChildren( function(n) {
n.style.width = "";
}, nTfootSize.getElementsByTagName('tr') );
}, anFootSizers );
}
// If scroll collapse is enabled, when we put the headers back into the body for sizing, we
@ -306,8 +310,6 @@ function _fnScrollDraw ( o )
/* We want the hidden header to have zero height, so remove padding and borders. Then
* set the width based on the real headers
*/
anHeadToSize = o.nTHead.getElementsByTagName('tr');
anHeadSizers = nTheadSize.getElementsByTagName('tr');
// Apply all styles in one pass. Invalidates layout only once because we don't read any
// DOM properties.
@ -330,9 +332,6 @@ function _fnScrollDraw ( o )
/* Same again with the footer if we have one */
if ( o.nTFoot !== null )
{
anFootSizers = nTfootSize.getElementsByTagName('tr');
anFootToSize = o.nTFoot.getElementsByTagName('tr');
_fnApplyToChildren( zeroOut, anFootSizers );
_fnApplyToChildren( function(nSizer) {