如何在Chrome开发工具中使用getEventListeners? [英] How to use getEventListeners in Chrome Dev Tool?

查看:1339
本文介绍了如何在Chrome开发工具中使用getEventListeners?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试追溯到 .someclass 的click事件中。我打开Chrome开发工具并输入这个



getEventListeners(document.querySelector('。someclass')); / p>

结果是这个



Object {} / p>

我无法单击并打开它来查找对象的名称或处理点击事件的源代码。



有没有办法找出?



更新1:



紧接着 Krasimir的建议如下。可能只有两个事件: mousemove mouseover 。那么如何才能找出 canvas.overlay 的事件的确切功能处理?有太多的深入了解。



解决方案


  1. 打开DevTools

  2. 打开元素选项卡并找到元素(.someclass)

  3. 每个元素有四个选项卡 - 样式,属性,DOM断点和事件侦听器

  4. 选择事件监听器


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.

解决方案

  1. Open the DevTools
  2. Open the Elements tab and locate your element (.someclass)
  3. There are four tabs per element - Styles, Properties, DOM Breakpoints and Event Listeners
  4. Select Event Listeners

这篇关于如何在Chrome开发工具中使用getEventListeners?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆