From 45a6d2b505fd0d364cafe4ceac693c2dda8de8ad Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sat, 4 Aug 2012 09:34:26 +0100 Subject: [PATCH] Fix: null values that were applied to extended object properties were not being correctly applied since typeof null === 'object' - 11180 --- media/js/jquery.dataTables.js | 10 +++++++--- media/src/core/core.support.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index a7ddc4e3..fc4415b5 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -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; } } } diff --git a/media/src/core/core.support.js b/media/src/core/core.support.js index 5fe8544c..7051697b 100644 --- a/media/src/core/core.support.js +++ b/media/src/core/core.support.js @@ -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; } } }