Yan*_*ang 3 javascript jquery events google-chrome
(在Chrome中)是否有一种简单的方法可以确定何时从元素中删除事件处理程序(用于单击)?我的事件处理程序神秘地消失了,但我不确定是否有一种快速简便的方法可以暂停或获得堆栈跟踪/异常.
在您的调试环境中,运行此代码并查看您的代码console.
(function () {
var ael = Node.prototype.addEventListener,
rel = Node.prototype.removeEventListener;
Node.prototype.addEventListener = function (a, b, c) {
console.log('Listener', 'added', this, a, b, c);
ael.apply(this, arguments);
};
Node.prototype.removeEventListener = function (a, b, c) {
console.log('Listener', 'removed', this, a, b, c);
rel.apply(this, arguments);
};
}());
Run Code Online (Sandbox Code Playgroud)
如果有必要查看更多信息,您可能还需要调用console.trace或赋予函数一个名称,以便您可以使用.caller(arguments.callee折旧,因此使用名称来引用self)
| 归档时间: |
|
| 查看次数: |
934 次 |
| 最近记录: |