Call to jquery with null not quite legal
Call to jquery with null not quite legal
I have been using jQuery.lint to help me clean up my use of jQuery. In the process, datatables is flagged as making a call with a lone argument of null. When I check the jQuery documentation, nowhere does it mention the defined behavior of this case. Although no runtime error is thrown, the purist in me would like all code to not rely on undocumented side-effects. The code in question in the 1.10.0-dev line is at line 1528, but the same code is in the 1.9.X line:
[code]
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
[/code]
The issue is that oSettings.nTFoot is null. I fixed this in my local copy by testing oSettings.nTFoot before invoking the callback:
[code]
if (oSettings.nTFoot) {
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
}
[/code]
[code]
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
[/code]
The issue is that oSettings.nTFoot is null. I fixed this in my local copy by testing oSettings.nTFoot before invoking the callback:
[code]
if (oSettings.nTFoot) {
_fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0],
_fnGetDataMaster( oSettings ), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay ] );
}
[/code]
This discussion has been closed.