admin管理员组文章数量:1331849
I am trying to debug someone else's UI implementation, and it is really hard at this point to know what events are calling which functions
.
Is there a way to know what function
was called when I trigger an event? Maybe with Firebug
?
I am trying to debug someone else's UI implementation, and it is really hard at this point to know what events are calling which functions
.
Is there a way to know what function
was called when I trigger an event? Maybe with Firebug
?
- Are the events attached to inspectable DOM elements? – Dagg Nabbit Commented Mar 12, 2012 at 3:11
- That is what I can't figure out. – Nic Hubbard Commented Mar 12, 2012 at 3:21
- How do you trigger the events? By clicking things, moving the mouse, etc? – Dagg Nabbit Commented Mar 12, 2012 at 3:22
- It is a click event, but I can't find a reference to what that is bound to. – Nic Hubbard Commented Mar 12, 2012 at 3:27
-
In that case it's probably bound to
window
ordocument
(assuming it happens when you click anywhere). I was going to suggest selecting the element and looking in the "Event Listeners" panel, but I guess that won't help. – Dagg Nabbit Commented Mar 12, 2012 at 3:36
3 Answers
Reset to default 4In chrome developer toolbar you can set event breakpoints. - hope this will help
There's an extension to Firebug called EventBug. There are actually quite a few extensions to Firebug that are awesome.
http://getfirebug./wiki/index.php/Firebug_Extensions#Eventbug
EventBug lets you see the event functions that are attached to an element and set breakpoints in their handlers.
You may also try to use Firebug's "Break on next" feature when in Script Tab. After enabling it, it will break whenever some script is going to be executed.
This however has a disadvantage that if you use a framework that is listening to mouse events globally (e.g. bound to <body>
), you will get a break point whenever you move your mouse, so then it's pletely useless.
Also, when there is some timeout set that fires before you manage to create your event (e.g. mouse click), the break will occur on that timeout.
本文标签: javascriptDebug which function was fired using FirebugStack Overflow
版权声明:本文标题:javascript - Debug which function was fired using Firebug - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742257178a2441841.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论