简体   繁体   English

Firebug从单个javascript文件中禁用警告

[英]Firebug Disable warnings from single javascript file

I am using jquery and jquery ui. 我正在使用jquery和jquery ui。 During development firefox throws many warnings for jquery .js and .css files and overflows console. 在开发期间,firefox会为jquery .js和.css文件抛出许多警告并溢出控制台。

What I want to do is to filter all warnings from jquery-ui files (and probably from other libraries). 我想要做的是过滤来自jquery-ui文件(可能还有其他库)的所有警告。

I have already tried: 我已经尝试过了:

  • Disabling all warnings, but I do not see warnings from my files. 禁用所有警告,但我没有看到来自我的文件的警告。
  • Prefixing all my files with "fanta_" prefix, and puting "fanta_" in firebug filter, but it does not shows errors from other libraries. 使用“fanta_”前缀为我的所有文件添加前缀,并在firebug过滤器中添加“fanta_”,但它不会显示其他库中的错误。
  • Most of errors are from loading jquery ui. 大多数错误来自加载jquery ui。 I can clear them with console.clear() in $(document).load(), but I loose load warnings from my own scripts. 我可以使用$(document).load()中的console.clear()清除它们,但是我从自己的脚本中删除了加载警告。

Is there a better/other way? 有更好的/其他方式吗?

I use jquery ui, which comes with its own jquery, but I also use other libraries: - jQuery UI - v1.10.3 - 2013-08-29 - jQuery JavaScript Library v1.9.1 Date: 2013-2-4 - jquery.csv-0.71.js example error is (translated from Polish): 我使用jquery ui,它有自己的jquery,但我也使用其他库: - jQuery UI - v1.10.3 - 2013-08-29 - jQuery JavaScript Library v1。9。1日期:2013-2-4 - jquery.csv -0.71.js示例错误是(从波兰语翻译):

Error during processing value for „filter”.  Declaration skipped.
http://localhost/ext/jquery-ui/css/ui-lightness/jquery-ui-custom.css
Line 920

If you see JavaScript warnings coming from your jQuery file, then you should turn off the Console panel option Strict Warnings . 如果您看到来自jQuery文件的JavaScript警告,则应关闭“ 控制台”面板选项“ 严格警告” This option doesn't change the display of CSS errors like the one you listed, though. 但是,此选项不会更改您列出的CSS错误的显示。

Filtering log messages coming from specific URLs is currently not possible in Firebug, though issue 2955 requests this feature called "black boxing". 目前在Firebug中无法过滤来自特定URL的日志消息,但问题2955请求此功能称为“黑色拳击”。

Also there is issue 4885 , which describes black boxing JavaScripts in the debugger, ie they should be ignored while debugging. 还有问题4885 ,它描述了调试器中的黑色装箱JavaScripts,即在调试时应忽略它们。

As a temporary workaround you can simply comment out your jQuery UI CSS file to see just the CSS errors coming from your own files. 作为临时解决方法,您只需注释掉您的jQuery UI CSS文件,即可查看来自您自己文件的CSS错误。

Another solution would be to load the jQuery related files before your own ones and call console.clear() as soon as the jQuery script is loaded, so within an event handler listening to the onload event of the script. 另一种解决方案是在您自己的文件之前加载jQuery相关文件,并在加载jQuery脚本时立即调用console.clear() ,因此在事件处理程序中监听脚本的onload事件。 That doesn't guarantee, though, that all errors from your files will be listed after clearing the console because of the asynchronous loading of CSS and JavaScript files. 但是,这并不能保证在清除控制台后会列出文件中的所有错误,因为CSS和JavaScript文件会异步加载。

Sebastian 塞巴斯蒂安

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

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