简体   繁体   English

Firefox Firebug扩展 - 冻结Javascript功能?

[英]Firefox Firebug Extension - Freeze Javascript Feature?

How can I freeze Javascript in firebug so that i can inspect the changes made by it in the html? 如何在firebug中冻结Javascript,以便我可以在html中检查它所做的更改? If for example i have a jQuery rollover effect and i want to inspect the html code in that point in time. 例如,如果我有一个jQuery翻转效果,我想在那个时间点检查HTML代码。

I believe Dreamweaver CS4 has this feature titled freeze javascript and live code. 我相信Dreamweaver CS4有这个功能名为freeze javascript和live code。 Is there a free equivalent either in Firebug or another Firefox extension? 在Firebug或其他Firefox扩展中是否有免费的等价物?

Break on mutate (the pause button when the html tab is selected) is the closest thing I can find to this feature. mut on mutate(选择html选项卡时的暂停按钮)是我能找到的最接近此功能的东西。 It will pause the next time something is changed. 它会在下次更改时暂停。 It's just one off of what you want, but could be useful. 它只是你想要的一个,但可能有用。

By "freeze" I assume you mean debugging, and yes, Firebug definitely has that. 通过“冻结”,我认为你的意思是调试,是的,Firebug肯定有这个。

First you have to go into the Script tab on Firebug. 首先,您必须进入Firebug上的“脚本”选项卡。 If Script is disabled on the site, enable it. 如果在站点上禁用了脚本,请启用它。

Now, go to the dropdown and select which JavaScript file you want to debug. 现在,转到下拉列表并选择要调试的JavaScript文件。 This is typically either the page itself with inline JavaScript, or a linked page. 这通常是具有内联JavaScript的页面本身或链接页面。 Find the line of code you want to freeze on, and click to the left of the line numbers. 找到要冻结的代码行,然后单击行号左侧。 You'll see a red dot appear - this dot denotes that the code will freeze there during execution. 你会看到一个红点出现 - 这个点表示代码将在执行期间冻结。 Once the code is there, you can access the current HTML by going to the "HTML" tab. 代码存在后,您可以通过转到“HTML”选项卡来访问当前的HTML。 You'll also see the icons in the top-right corner of Firebug's Script pane light up, allowing you to either continue execution, step over, step into, or step out of each line of code, observing HTML changes for each line executed. 您还会看到Firebug脚本窗格右上角的图标亮起,允许您继续执行,跳过,步入或逐步退出每行代码,观察每行执行的HTML更改。

Note that Firebug lets you step through code line-by-line, which means that minimized JavaScript files (wherein all the code is compacted onto one line) are absolutely awful for debugging, because you can't tell where Firebug is. 请注意,Firebug允许您逐行遍历代码,这意味着最小化的JavaScript文件(其中所有代码都压缩到一行)对于调试来说是非常糟糕的,因为您无法分辨Firebug的位置。 So for debugging purposes, I highly recommend getting the non-minimized versions of files. 因此,出于调试目的,我强烈建议您获取非最小化版本的文件。

If you need more help, I suggest checking out the Firebug documentation , which has some good guides. 如果您需要更多帮助,我建议您查看Firebug文档 ,其中包含一些很好的指南。

not exactly firefox function, but appears close enough (at least in the way I understand the question): 不完全是firefox功能,但看起来足够接近(至少在我理解问题的方式):

  1. Get CheatEngine 得到CheatEngine
  2. Open firefox process 打开firefox进程
  3. Check "enable speedhack" 检查“启用speedhack”
  4. Set speed to 0 将速度设置为0
  5. Apply 应用
  6. All scripts are now effectively paused 现在所有脚本都已暂停

You can test this on a javascript clock here . 你可以在这里的javascript时钟测试这个。

I'm kind of dissapointed that noone has created a plugin for firefox, which would do the same. 我有点失望,没有人为firefox创建了一个插件,它会做同样的事情。

In the Script tab of Firebug, you can set break points in Javascript that will allow you to step through code, set watches, and do other things you would in other debuggers. 在Firebug的“脚本”选项卡中,您可以在Javascript中设置断点,以允许您单步执行代码,设置监视以及执行其他调试程序中的其他操作。 You can also switch to the HTML tab and see what changes have been made while Javascript is "frozen." 您还可以切换到HTML选项卡,看看在Javascript被“冻结”时所做的更改。

In Firebug, go to the script tab. 在Firebug中,转到脚本选项卡。 On the top, you can see: 在顶部,您可以看到:

Inspect | all | <filename>

Click on to choose the file that contain the javascript you want to track. 单击以选择包含要跟踪的JavaScript的文件。 Once you have selected your file, click on a line number to put a brea kpoint (a big red dot will appear). 选择文件后,单击行号以放置一个brea kpoint(将出现一个大的红点)。

You can put several break points in different files. 您可以在不同的文件中放置几个​​断点。 The break point will not disappear if you refresh the page (F5). 如果刷新页面,断点不会消失(F5)。

This tutorial should help you as well. 教程也应该对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM