Skip to content

Commit

Permalink
Clear orphaned intervals when target element is arbitrary removed fro…
Browse files Browse the repository at this point in the history
…m DOM
  • Loading branch information
Gaspare Sganga committed Jul 3, 2018
1 parent ff40900 commit ecd7bfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/loadingoverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,12 @@ LoadingOverlay - A flexible loading overlay jQuery plugin
if (typeof data === "undefined") {
// Clean DOM
$(".loadingoverlay").each(function(){
var $this = $(this);
if (!document.body.contains($this.data("loadingoverlay_data").container[0])) $this.remove();
var $this = $(this);
var data = $this.data("loadingoverlay_data");
if (!document.body.contains(data.container[0])) {
if (data.resizeIntervalId) clearInterval(data.resizeIntervalId);
$this.remove();
}
});
return false;
} else {
Expand Down

0 comments on commit ecd7bfb

Please sign in to comment.