mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-03 15:24:10 +01:00
Performance: Width of scrollbars isn't going to change on a single page
between table's being reinitialised, so calculating the scrollbar width every time is a real hit on performance since it needs to manipulate the DOM. This change ensures that the calculation is performed only once.
This commit is contained in:
parent
182998a7c5
commit
ad0e08585f
@ -378,6 +378,8 @@ function _fnStringToCss( s )
|
|||||||
*/
|
*/
|
||||||
function _fnScrollBarWidth ()
|
function _fnScrollBarWidth ()
|
||||||
{
|
{
|
||||||
|
if ( ! DataTable.__scrollbarWidth )
|
||||||
|
{
|
||||||
var inner = $('<p/>').css( {
|
var inner = $('<p/>').css( {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 200,
|
height: 200,
|
||||||
@ -408,6 +410,9 @@ function _fnScrollBarWidth ()
|
|||||||
|
|
||||||
outer.remove();
|
outer.remove();
|
||||||
|
|
||||||
return w1 - w2;
|
DataTable.__scrollbarWidth = w1 - w2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataTable.__scrollbarWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user