Js内存泄漏,在IE里面好像没什么影响,但是如果在应用程序中使用了js脚本,问题就大了,特别是如果在Office插件里面的HtmlView控件里面的Js脚本,Office应用程序就突然退出了。
function ReleaseEvents()
{
var events = ["focus", "blur", "change", "click", "mousedown",
"mouseup", "mouseover", "keypress", "keydown",
"keyup", "keypress"];
var helper = function(obj)
{
var i;
for (i = 0; i < events.length; i++)
obj["on" + events[i]] = null;
for (i = 0; i < parent.childNodes.length; i++)
helper(parent.childNodes[i]);
}
helper(document);
}
window.onunload = ReleaseEvents;
{
var events = ["focus", "blur", "change", "click", "mousedown",
"mouseup", "mouseover", "keypress", "keydown",
"keyup", "keypress"];
var helper = function(obj)
{
var i;
for (i = 0; i < events.length; i++)
obj["on" + events[i]] = null;
for (i = 0; i < parent.childNodes.length; i++)
helper(parent.childNodes[i]);
}
helper(document);
}
window.onunload = ReleaseEvents;