Javascript 为什么赢了';t在IE中发生火灾<;9?

Javascript 为什么赢了';t在IE中发生火灾<;9?,javascript,internet-explorer,events,Javascript,Internet Explorer,Events,我已经设置了最简单的事件处理函数。除了IE

我已经设置了最简单的事件处理函数。除了IE<9中的
events.remove()
之外,一切都很正常。因此,换句话说,除了在使用
.detachEvent()
的IE版本中删除事件外,其他一切都非常有效

我一直在IETester和VirtualBox上测试,使用IE8运行Windows XP

events = {
    add: (function () {
        if (document.documentElement.addEventListener) {
            return function (elm, type, func) {
                elm.addEventListener(type, func, false);
            };
        } else if (document.documentElement.attachEvent) {
            return function (elm, type, func) {
                elm.attachEvent('on' + type, function () {
                    func.call(elm, window.event);
                });
                elm = null; //clean up possible memory leaks?
            };
        }
    }()),
    remove: (function () {
        if (document.documentElement.removeEventListener) {
            return function (elm, type, func) {
                elm.removeEventListener(type, func, false);
            };
        } else if (document.documentElement.detachEvent) {
            return function (elm, type, func) {
                elm.detachEvent('on' + type, function () {
                    func.call(elm, window.event);
                });
                elm = null; //clean up possible memory leaks?
            };
        }
    }())
};

因为您尝试使用与绑定的函数不同的函数分离


它们都是匿名函数这一事实并不重要。它们是两个不同的函数对象。

因为您试图使用与绑定的函数不同的函数分离


它们都是匿名函数这一事实并不重要。它们是两个不同的功能对象。

我需要更多睡眠“叹气+掌心”谢谢!我需要更多的睡眠“叹气+掌心”谢谢!