如何在Chrome开发工具中使用getEventListeners? [英] How to use getEventListeners in Chrome Dev Tool?
问题描述
我尝试追溯到 .someclass
的click事件中。我打开Chrome开发工具并输入这个
getEventListeners(document.querySelector('。someclass'));
/ p>
结果是这个
Object {}
/ p>
我无法单击并打开它来查找对象的名称或处理点击事件的源代码。
有没有办法找出?
更新1:
紧接着 Krasimir的建议如下。可能只有两个事件: mousemove
或 mouseover
。那么如何才能找出 canvas.overlay
的事件的确切功能处理?有太多的深入了解。
- 打开DevTools
- 打开元素选项卡并找到元素(.someclass)
- 每个元素有四个选项卡 - 样式,属性,DOM断点和事件侦听器
- 选择事件监听器
I tried to trace back which function hooked into a click event of .someclass
. I open Chrome Dev Tool and type this
getEventListeners(document.querySelector('.someclass'));
The result is this
Object {}
I cannot click and open it to find out the name of the object or the source code that handle click event.
Is there a way to find out?
UPDATE 1:
Followed Krasimir's advise below. There could be only two events: mousemove
or mouseover
. So how do I find out the exact function handling that event for canvas.overlay
? There are just too many to drill down into.
- Open the DevTools
- Open the Elements tab and locate your element (.someclass)
- There are four tabs per element - Styles, Properties, DOM Breakpoints and Event Listeners
- Select Event Listeners
这篇关于如何在Chrome开发工具中使用getEventListeners?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!