zachleat’s Ugly Mug

Zach Leatherman

Forward Compatibility and JavaScript

01 November 2007 Read this in about 1 minute.

Warning

This article is fairly old and probably contains information that is no longer relevant. Read with care!

Many developers (myself included) complain endlessly about the problematic ECMAScript implementation that Internet Explorer uses called JScript. And after reading one such very detailed complaint in the comments on Dave Massy’s website at MSDN, and reading Chris Wilson’s post about ECMAScript 3, it has become increasingly obvious of Microsoft’s opinion on the subject of Forward Compatibility with JavaScript. It’s something they keep pounding their fists on the ground about, how they are adamant that new versions of their browser not “Break the Web.”

Of course, “Breaking the Web” refers to the amount of code on the internet today that is an equal and opposite reaction to the broken bug-ridden JavaScript implementation of their browser. It describes the unimaginable future in which Internet Explorer fixed the many well documented intricacies of JScript and thereby ruins the code that was originally written to support the problem. What a conundrum.

But haven’t we already been through this problem? Isn’t this the same exact thing we saw in the early days of CSS? And how did the major browser players react? By implementing both a Quirks and Standards mode for CSS through DocType switching. Now my question is:

Why haven’t we seen a Quirks and Standards Compatibility Mode for JavaScript?

I’m not necessarily encouraging the Quirks and Standards modes to be toggled with the DocType (as with CSS), but why not have these two modes? To enable your site to use the Standards mode of JavaScript, the browser might require a certain DocType to be declared, or it might require a different script type in the browser:

<script type="text/javascript" mode="standards">

Either that, or I could just use Base2.