diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 3f9ad137..61467532 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -3563,25 +3563,24 @@ */ function _fnConvertToWidth ( sWidth, nParent ) { - if ( !sWidth || sWidth === null || sWidth === '' ) + if ( ! sWidth ) { return 0; } - if ( !nParent ) + if ( ! nParent ) { nParent = document.body; } - var iWidth; - var nTmp = document.createElement( "div" ); - nTmp.style.width = _fnStringToCss( sWidth ); + var n = $('
') + .css( 'width', _fnStringToCss( sWidth ) ) + .appendTo( nParent ); + + var width = n.offsetWidth; + n.remove(); - nParent.appendChild( nTmp ); - iWidth = nTmp.offsetWidth; - nParent.removeChild( nTmp ); - - return ( iWidth ); + return width; } diff --git a/media/src/core/core.sizing.js b/media/src/core/core.sizing.js index 54073bb8..d933204e 100644 --- a/media/src/core/core.sizing.js +++ b/media/src/core/core.sizing.js @@ -7,25 +7,24 @@ */ function _fnConvertToWidth ( sWidth, nParent ) { - if ( !sWidth || sWidth === null || sWidth === '' ) + if ( ! sWidth ) { return 0; } - if ( !nParent ) + if ( ! nParent ) { nParent = document.body; } - var iWidth; - var nTmp = document.createElement( "div" ); - nTmp.style.width = _fnStringToCss( sWidth ); + var n = $('') + .css( 'width', _fnStringToCss( sWidth ) ) + .appendTo( nParent ); + + var width = n.offsetWidth; + n.remove(); - nParent.appendChild( nTmp ); - iWidth = nTmp.offsetWidth; - nParent.removeChild( nTmp ); - - return ( iWidth ); + return width; }