使用Firefox,如何监视所有引发的事件? [英] Using Firefox, how can I monitor all events that are fired?

查看:159
本文介绍了使用Firefox,如何监视所有引发的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试大量使用事件的网页,因此我需要监视所有触发的事件.

I'm trying to debug a web page that makes heavy use of events, and so I need to monitor all events that are fired.

大多数事件是使用jQuery绑定的.因此,如果有一种方法专门监视那些事件,那将特别有用.

Most of the events are bound using jQuery. Hence, it would be particularly useful if there was a way to specifically monitor only those events.

推荐答案

当然,您可以使用 Firebug ,在控制台和脚本选项卡上,您可以在其中添加断点和监视,但是显然您想使其更智能/更轻松.

Of course you can do just fine with Firebug, the console and the scripts tab where you can add breakpoints and watches, but you want to do it smarter / easier obviously.

有一个名为 EventBug 的简洁Firebug插件,所有事件并按事件类型将它们分组,以便您可以扩展并查看触发它们的原因.

There is a neat Firebug plugin called EventBug that just logs all the events and groups them by event type so you can expand and see what triggered them.

EventBug不能实时执行,但您必须刷新.

EventBug doesn't do it realtime, you have to refresh though.

另一种方法是对Firebug中的任何DOM元素使用日志事件"功能.这确实做到了,您还可以查看触发/触发了哪些订单事件.

One other way is to use the 'Log Events' feature against any DOM element in Firebug. This does do it realtime and you can see what order events are fired / triggered as well.

尝试一下:

  • 切换打开Firebug
  • 右键单击HTML选项卡中的元素,如果要查看所有事件,请右键单击<body>
  • 从上下文菜单中选择Log Events
  • 确保已启用控制台"标签
  • 单击以在控制台"选项卡中启用持久"模式(否则,在重新加载页面后,控制台"选项卡将清除)
  • 您可能必须手动选择Closed
  • Voila!在控制台标签中观看事件流
  • Toggle open Firebug
  • Right click the element in HTML tab, if you want to see all events then right click <body>
  • Choose Log Events from the context menu
  • Make sure the Console tab is enabled
  • Click to enable the 'Persist' mode in the Console tab (otherwise Console tab will clear after the page is reloaded)
  • You may have to select Closed (manually)
  • Voila! watch events stream in the console tab

这是您在日志事件"中看到的内容:

This is what you see with Log Events:

还值得尝试为Firebug使用 FireQuery 插件来查看DOM中的哪些元素附加了jQuery事件.给他们和他们是什么.

Also worth trying the FireQuery add-on for Firebug to see what elements in the DOM have jQuery events attached to them and what they are.

并且正如benvie的答案提到的那样,这在webkit的开发人员工具中也是可能的.

And as benvie's answer mentions, this is possible in webkit's developer tools as well.

这篇关于使用Firefox,如何监视所有引发的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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