用Firebug检测网页上的错误 [英] Detect errors on web page with Firebug

查看:210
本文介绍了用Firebug检测网页上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发团队倾向于使用Firefox和Firebug进行Web开发。我们注意到一些错误蔓延到代码库中,通常是重复的属性,如:

 < div id =MyDivclass =hideclass =interestingDiv> 

我们在Firebug的控制台中看不到任何错误,也无法看到Firebug报告存在错误。

我们注意到Firefox本身也知道这些错误。通过点击查看页面源代码,Firefox呈现红色的第二个类,并具有重复属性的工具提示。然而,我们必须通过代码自己寻找红色突出显示的任何错误。

肯定有比手动查看代码更好的方法吗?我们应该使用什么工具?



谢谢,


http://validator.w3.org/
  • 您可能想要遵循Firefox bug 878364 要求提供HTML错误。


  • What is the best way to check our web applications for errors such as "duplicate attribute"?

    My development team tends to use Firefox and Firebug for web development. We've noticed some errors creeping into the codebase, usually duplicate attributes such as:

    <div id="MyDiv" class="hide" class="interestingDiv">
    

    We see no errors in Firebug's console nor can see anyway to get Firebug to report that there are errors.

    We have noticed that Firefox itself IS aware of these errors. By clicking on "View Page Source", Firefox renders the second class in red and has a tooltip of "Duplicate Attribute". However we have to hunt through the code ourselves looking for any errors highlighted in red.

    Surely there is a better way than manually looking at the code? What tools should we be using?

    Thanks,

    Phil

    解决方案

    Firefox automatically corrects HTML errors like duplicate attributes, i.e. it just ignores the second attribute. It doesn't expose this as error to its Browser Console.

    Firebug just displays the error messages Firefox exposes via its APIs, it doesn't anaylize the HTML/CSS/JavaScript by itself. So as Firefox doesn't produce an error message for incorrect HTML, Firebug's Console panel doesn't display anything related to that.

    Though Firefox offers another way to display HTML errors via is its source view. To get there just right-click into the page and choose View Page Source from the context menu. This view highlights duplicate attributes in red:

    Other options you have are:

    1. Use an HTML validator tool like the Html Validator add-on for Firefox or http://validator.w3.org/.
    2. You may want to follow the Firefox bug 878364 asking for exposing HTML errors.

    这篇关于用Firebug检测网页上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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