mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2024-11-26 17:26:15 -05:00
try to fix memory leaks
If the element is no longer in the DOM tree, stop its corresponding setInterval in the next cycle.
This commit is contained in:
parent
05a85b77f9
commit
b5a364d3a2
1 changed files with 7 additions and 0 deletions
|
@ -175,6 +175,13 @@
|
|||
};
|
||||
|
||||
function refresh() {
|
||||
//check if it's still visible
|
||||
if(!$.contains(document.documentElement,this)){
|
||||
//stop if it has been removed
|
||||
$(this).timeago("dispose");
|
||||
return this;
|
||||
}
|
||||
|
||||
var data = prepareData(this);
|
||||
var $s = $t.settings;
|
||||
|
||||
|
|
Loading…
Reference in a new issue