一直在研究应用程序,因为它有点太大我想到了改善内存管理的方法,因为应用程序主要在Javascipt上运行.因此,每次单击导航项时,我都会将jquery称为空,然后通过ajax显示html.例如:
//$.ajaxSetup(); called before this
//$this is the attached element
$.ajax({success:function(data){
$this.empty().html(data.output).fadeIn(400);
//more javascript stuff like loading tinymce or jquery ui
}});
Run Code Online (Sandbox Code Playgroud)
这足以防止内存泄漏吗?我不完全确定空的是什么,但我假设它删除了该div中的所有DOM元素以及任何其他对象和事件?顺便说一句.您可以在http://webproposalgenerator.com/和http://webproposalgenerator.com/demo找到该应用.
任何提高性能/安全性或任何反馈的提示都将不胜感激.