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

Fix: null values that were applied to extended object properties were not being correctly applied since typeof null === 'object' - 11180

This commit is contained in:
Allan Jardine 2012-08-04 09:34:26 +01:00
parent 5311067cd2
commit 45a6d2b505
2 changed files with 14 additions and 6 deletions

View File

@ -4716,17 +4716,21 @@
*/
function _fnExtend( oOut, oExtender )
{
var val;
for ( var prop in oExtender )
{
if ( oExtender.hasOwnProperty(prop) )
{
if ( typeof oInit[prop] === 'object' && $.isArray(oExtender[prop]) === false )
val = oExtender[prop];
if ( typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false )
{
$.extend( true, oOut[prop], oExtender[prop] );
$.extend( true, oOut[prop], val );
}
else
{
oOut[prop] = oExtender[prop];
oOut[prop] = val;
}
}
}

View File

@ -166,17 +166,21 @@ function _fnMap( oRet, oSrc, sName, sMappedName )
*/
function _fnExtend( oOut, oExtender )
{
var val;
for ( var prop in oExtender )
{
if ( oExtender.hasOwnProperty(prop) )
{
if ( typeof oInit[prop] === 'object' && $.isArray(oExtender[prop]) === false )
val = oExtender[prop];
if ( typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false )
{
$.extend( true, oOut[prop], oExtender[prop] );
$.extend( true, oOut[prop], val );
}
else
{
oOut[prop] = oExtender[prop];
oOut[prop] = val;
}
}
}