Skip to content

Commit

Permalink
Fix: IE6/7 could crash when loading a DataTable on page load due to t…
Browse files Browse the repository at this point in the history
…he binding of a `resize` event listener on the window object

* Reported in thread 27428
* This SO thread was helpful: http://stackoverflow.com/questions/1264443
  • Loading branch information
Allan Jardine committed Apr 29, 2015
1 parent 354c9cb commit 94636f8
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions js/core/core.sizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,20 @@ function _fnCalculateColumnWidths ( oSettings )
}

if ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) {
$(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {
_fnAdjustColumnSizing( oSettings );
} ) );
var bindResize = function () {
$(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () {
_fnAdjustColumnSizing( oSettings );
} ) );
};

// IE6/7 will crash if we bind a resize event handler on page load.
// To be removed in 1.11 which drops IE6/7 support
if ( oSettings.oBrowser.bScrollOversize ) {
setTimeout( bindResize, 1000 );
}
else {
bindResize();
}

oSettings._reszEvt = true;
}
Expand Down

0 comments on commit 94636f8

Please sign in to comment.