mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-02 14:24:11 +01:00
Fix: If there was a nested table in the thead of our target table, then the getElementsByTagName was getting the wrong element - so use a more specific jQuery selector.
This commit is contained in:
parent
55c4e0ac9c
commit
2eacc63f87
23
media/js/jquery.dataTables.js
vendored
23
media/js/jquery.dataTables.js
vendored
@ -7245,23 +7245,28 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Final init
|
* Final init
|
||||||
* Sanity check that there is a thead and tbody. If not let's just create them
|
* Cache the header, body and footer as required, creating them if needed
|
||||||
*/
|
*/
|
||||||
if ( this.getElementsByTagName('thead').length === 0 )
|
var thead = $('>thead', this);
|
||||||
|
if ( thead.length === 0 )
|
||||||
{
|
{
|
||||||
this.appendChild( document.createElement( 'thead' ) );
|
thead = [ document.createElement( 'thead' ) ];
|
||||||
|
this.appendChild( thead[0] );
|
||||||
}
|
}
|
||||||
|
oSettings.nTHead = thead[0];
|
||||||
|
|
||||||
if ( this.getElementsByTagName('tbody').length === 0 )
|
var tbody = $('>tbody', this);
|
||||||
|
if ( tbody.length === 0 )
|
||||||
{
|
{
|
||||||
this.appendChild( document.createElement( 'tbody' ) );
|
tbody = [ document.createElement( 'tbody' ) ];
|
||||||
|
this.appendChild( tbody[0] );
|
||||||
}
|
}
|
||||||
|
oSettings.nTBody = tbody[0];
|
||||||
|
|
||||||
oSettings.nTHead = this.getElementsByTagName('thead')[0];
|
var tfoot = $('>tfoot', this);
|
||||||
oSettings.nTBody = this.getElementsByTagName('tbody')[0];
|
if ( tfoot.length > 0 )
|
||||||
if ( this.getElementsByTagName('tfoot').length > 0 )
|
|
||||||
{
|
{
|
||||||
oSettings.nTFoot = this.getElementsByTagName('tfoot')[0];
|
oSettings.nTFoot = tfoot[0];
|
||||||
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
|
_fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user