【发布时间】:2011-12-30 21:45:24
【问题描述】:
我有这个:
function test()
{
this.method = function ()
{
$("html").mousemove(function(event) {
console.log('~> moved');
});
}
this.method();
}
testInstance = new test();
testInstance = null; // delete window.testInstace;
虽然我已通过将testInstance 设置为null 来删除对对象的引用(我也尝试将其作为window 的属性删除),但mousemove 事件处理程序继续运行并写入控制台。如果删除建立事件处理程序的对象没有删除它,那么我应该怎么做才能删除事件处理程序?
【问题讨论】:
-
你必须明确解除绑定事件处理程序。
-
JS 没有“删除”对象的概念。
标签: javascript jquery object