Skip to content

Commit 8b1035d

Browse files
committed
fix Timers leaks: if { advanced : { updateOnContentResize : true } } , when dom destroy,that upd() function alway loop.
1 parent f617bb9 commit 8b1035d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jquery.mCustomScrollbar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,13 @@ and dependencies (minified).
18701870
upd();
18711871
function upd(){
18721872
clearTimeout(mCSB_container[0].autoUpdate);
1873+
1874+
/* check scroller in dom tree */
1875+
if($this.parents('html').length===0){
1876+
$this = null;
1877+
return;
1878+
}
1879+
18731880
mCSB_container[0].autoUpdate=setTimeout(function(){
18741881
/* update on specific selector(s) length and size change */
18751882
if(o.advanced.updateOnSelectorChange){

0 commit comments

Comments
 (0)