查看事件监听器 - Javascript [英] View event listeners - Javascript
问题描述
我想知道是否可以查看
1。有多少事件监听器
2。什么类型的事件监听器
在一个网页上。
原因是因为即时通讯使用 off();
方法。
Reason being is becuase im using off();
method.
我正在使用 框架 ,这是基本上是jQuery但不是。
I'm using this framework, which is basically jQuery but not.
是的,我正在使用,但偶数不会删除而且我感觉有多个 eventListener
关于元素。
Yeah, I'm using off but the even't isn't removing and and I have a feeling there is more than one eventListener
on the element.
如果javascript无法实现,可以在浏览器中使用吗?
If it is not possible with javascript, it is possible in the browser?
推荐答案
Chrome有一些内置工具。如果打开元素检查器,关注一个元素,滚动到右侧列的底部(CSS / Metrics / etc所在的位置),您应该看到一个显示事件监听器的下拉部分。这可以帮助一些......
Chrome has some built in tools. If you open up the element inspector, focus on an element, scroll to the bottom of the right hand column (where the CSS/Metrics/etc are), you should see a drop down section that says Event Listeners. This can help some...
通常我发现通过控制台向某些DOM元素添加事件监听器并查看它是否响应更容易。或者我在各个地方抛出调试器(在设置监听器之前,以及在监听器的回调中)。我经常遇到的问题是我认为存在的选择器没有,或者事件过早地绑定并错过了选择器。
Often I find it easier to just add event listeners to some DOM element via the console and seeing if it responds. Or I throw in debuggers in various places (before setting up the listener, and inside the listener's callback). The problems I usually run into is the selector I think exists doesn't or the event gets bound too early and misses the selector.
这篇关于查看事件监听器 - Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!