作者:阿什顿安抚_343 | 来源:互联网 | 2023-01-17 14:06
Idonthaveaspecificusecasehere,butoccasionallyIhavebeeneitherhelpingoutsomeoneonSO
I don't have a specific use case here, but occasionally I have been either helping out someone on SO or seen a cool Javascript effect on a website and been curious about the code that drives it. However, the event that drives the code may not be immediately obvious. If I can't find the event handler then it can be really hard to find the js responsible for the effects I am interested in. Is there a quick way in the debugger to identify the events attached to an element and to drop a break point in when it fires?
我这里没有特定的用例,但偶尔我会帮助某人或者在网站上看到一个很酷的Javascript效果,并对驱动它的代码感到好奇。但是,驱动代码的事件可能不会立即显而易见。如果我找不到事件处理程序那么很难找到负责我感兴趣的效果的js。在调试器中是否有一种快速方法来识别附加到元素的事件并删除断点在什么时候开火?
So for example an event may exist on a structure something like so
因此,例如,事件可能存在于类似的结构上
Now I don't know if the event is bound to the img, span, li, ul or div itself. Chrome has the Event Listeners area, but I feel like it doesn't always contain events. Anything you guys do that allows you to quickly find the event and drop a break point into it?
现在我不知道事件是否绑定到img,span,li,ul或div本身。 Chrome有“事件监听器”区域,但我觉得它并不总是包含事件。你们做的任何事情都可以让你快速找到事件并给它留下一个断点?
3 个解决方案