开发者

Web browsers: is there an equivalent to a compiler "warnings as errors" switch?

Like many other programmers, I consider enabling "Treat all warning as errors" a good practice when developing code. However, for web browsers, the standard behaviour is the exact opposite: "try guessing what I meant and render what seems to fit". In order to avoid overlooking any problems , for my development environment, I'd like to set my browsers so that any css, html or javascript problems, in开发者_运维百科stead of triggering quirks mode or silently logging a problem pops up a big fat error that I (or the UI designer I work with) can't miss.

Obviously, because of browser differences, I won't be able to do this for anything more than my main supported browsers - but can Chrome or Firefox or Internet Explorer 9 be set in such a way that any fallback mechanisms when encountering errors are disabled?


You can define "use strict"; at the beginning of a javascript part to use the ECMAScript5 parser, which parses stricter then the other one.


You can use HTML and CSS validators to verify content. If you dynamically generate content it's pretty easy to set it up to generate a big error message is something goes wrong...


When I'm in development mode I use ECMAScript 5 strict mode for javascript.

I've never found anything for CSS and HTML. I usually just run pages through validation pages, but I'd like to know if you find anything that achieves this, keep us posted!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜