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:
Andy Pan 2014-07-07 21:03:39 +08:00 committed by Ryan McGeary
parent 05a85b77f9
commit b5a364d3a2

View file

@ -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;