FF 错误控制台“警告”是否应该出现?如果页面没有“损坏”,会被认真对待吗?
我收到了从 FF 中的错误控制台生成的错误列表。我已经阅读此处了解了这个工具的确切含义以及重要性/priority 这些错误仅限于“错误修复”。 CSS 在这些特定页面上的 FF 以及 Safari、Chrome、IE 7/8/9 中呈现良好。我访问了几个网站(甚至 stackoverflow.com),似乎所有网站都有一长串“警告”,导致出现错误控制台。我引用了一位分享我的反应的人的话:
“错误控制台上的信息很丰富,但是信息本身是无用的,除非有关于如何修复*我的长列表中的特定错误的信息。也许有人有回答*。” 〜朱利安
*大胆补充。
我想知道如果页面没有“损坏”,我应该如何认真地考虑这个列表,特别是因为长“警告”列表在所有网站中都很常见。有人吗?
I'm got a list of errors that was generated from the Error Console in FF. I've done some reading here on exactly what this tool is and how important/priority these errors are as far as "bug fixes". The css is rendering fine in FF on these particular pages as well as in Safari, Chrome, IE 7/8/9. I've gone to several websites (even stackoverflow.com) and it appears that ALL websites have a Long list of 'warnings' resulting in the Error Console. I've quoted someone who shared my reaction:
"Great info on the ERROR CONSOLE however information for the its own sake is useless unless there is information on how to repair* the specific errors on my LONG LIST. Maybe someone has an answer*." ~ Jullian
*bold added.
I'm wondering how seriously I should consider this list if the pages are not "broken", especially since long "warning" lists are common among all websites. Anybody?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般来说,如果警告严重到需要采取措施,那么它们就是错误。
警告通常是浏览器认为可能是错误但又不确定的内容。由您来判断是否应该修复这些警告。
如果警告与 JavaScript 相关,那么修复它们可能是个好主意。 CSS 警告通常不太严重。 CSS 有很多特定于浏览器的怪癖,有时,需要一些技巧才能让浏览器正常工作,以至于浏览器很难知道什么应该被视为“坏”。出现大量可以忽略的 CSS 警告的情况并不罕见。
无论如何,您可能希望在忽略警告之前至少查看它们。他们可能会透露一些你没有想到的事情。
In general, if warnings are serious enough that action is required, they would be errors.
Warnings are usually things that the browser thinks might be a mistake but isn't sure. It's up to you to make a judgement call on whether or not the warnings should be fixed.
If the warnings are JavaScript related, it would probably be a good idea to fix them. CSS warnings are usually less serious. CSS has so many browser specific quirks and, sometimes, hacks required to get things working that the browser can have a hard time knowing what should be considered "bad". It's not uncommon for lots of CSS warnings to appear that can be ignored.
Regardless, you might want to at least look at the warnings before dismissing them. They might reveal something you didn't think of.
答案很大程度上取决于您遇到的错误是什么。
就 StackOverflow 而言,几乎所有报告的“错误”都是由于他们使用 CSS hacks 来针对特定浏览器(主要是不同版本的 IE)。
例如,在 SO 的样式表中,以下代码会引发一些错误:
\9
语法是无效的 CSS,Firefox 理所当然地抱怨它。但这种语法是故意的 CSS hack,它针对 IE8 及更早版本 (请参阅此处了解更多信息)。这里的目的是除了 IE8 及更早版本之外的所有浏览器都会看到这是一个错误并删除样式。同样,他们使用
filter
样式,该样式仅受 IE 支持。同样,这会在 Firefox 中引发错误,但他们希望如此,因为他们知道 Firefox 不支持这种风格。因此,在这种情况下,错误确实是预料之中的,开发人员不会担心它出现在 Firefox 的错误控制台中。
加载 SO 后查看错误控制台,这几乎适用于他们遇到的所有“错误”。他们会知道并期待所有这些错误,因此可以安全地忽略它们。
如果您还因故意黑客攻击而遇到错误,那么当它们出现在错误控制台中时,请随意忽略它们。
但是,如果您遇到了意料之外的错误,那么您肯定确实需要注意它。如果控制台出现错误,那么您可以确定的一件事就是 CSS 出现了问题。除非这是故意的黑客攻击,否则这将导致您的样式表无法按您的预期呈现网站。故障可能非常微妙,但它一定会存在。
The answer depends very much on what the errors are that you're getting.
In the case of StackOverflow, virtually all the "errors" being reported are due to their use of CSS hacks to target specific browsers (mainly different versions of IE).
For example, in SO's stylesheet, the following throws a couple of errors:
The
\9
syntax is invalid CSS, and Firefox rightfully complains about it. But this syntax is a deliberate CSS hack, which targets IE8 and earlier (See here for more info). The intention here is that all browsers other than IE8 and earlier would see that it is an error and drop the style.Likewise, they are using the
filter
style, which is only supported by IE. Again, this will throw errors in Firefox, but they're expecting it to because they know that Firefox doesn't support this style.Therefore in this context, the error is indeed expected and the developer would not worry about it appearing in Firefox's error console.
Looking through the error console after loading SO, this applies to virtually all the 'errors' they've got. They will know about and be expecting all of these errors, and they can thus be safely ignored.
If you're also getting your errors as a result of deliberate hacks, then feel free to ignore them when they show up in the error console.
However, if you're getting errors that you're not expecting, then you most certainly do want to pay attention to it. If there is an error in the console, then the one thing you can be certain of is that you have a broken bit of CSS. Unless it's a deliberate hack, then this will result in your stylesheets not rendering the site as you intended. The glitch may be very subtle, but it will be there.
控制台用于收集页面数据和调试。这些消息可用于诊断问题。如果您没有遇到任何问题,则无需担心。但有一天你可能会需要它,这就是它存在的原因。
The console is used to gather page data and debugging. These messages can be used to diagnose problems. If you are not experiencing any problems, then you are not required to worry. Some day you may need it though, and thats why its there.