Writing standard JavaScript code

Web standards trinityWhile developing this demo, I was struck by the fact that most of the JavaScript code we write is not meant to be full standard compliant but rather an attempt to make it work also in non-compliant browsers. In other words, we should code to the standards, not to the lowest common denominator (Internet Explorer). I think that IE's developers rely on the fact that the overwhelming majority of JavaScript scripts and libraries work on their browser just because web developers are forced to write non-standard code to make their scripts work even on a browser that is absolutely non-standard compliant.

In fact, Internet Explorer has the lowest implementation of ECMAScript and W3C DOM specifications. Most developers use an if...else approach to deal with IE inconsistencies and proprietary features. I think that this is a wrong approach, because if we continue to do so, Internet Explorer's developers won't probably build a better JavaScript engine just because they can count on the backward support used by scripts and libraries. So if we want that IE be a better browser, we should write standard JavaScript code without taking into account IE's inconsistencies and proprietary features.

When IE's developers will see that many web sites don't work on their browser anymore, they will probably start to reconsider their approach to web standards which, as many of you already know, has always been inconsistent and absolutely wrong.

Leave a Reply

Note: Only a member of this blog may post a comment.