views:

234

answers:

4

The Mozilla Foundation continues to add new language features to JavaScript. They're up to version 1.8 now where 1.5 was more or less the ECMA baseline.

However, Firefox is the only browser that supports the latest version and IE is firmly stuck at a 1.5-equivalent JScript.

What purpose do the Firefox-only extensions serve? Or are they just lying dormant until (and if) the rest of the browsers catch up?

+5  A: 

Extending the language is a good idea, even if only one browser is doing it - eventually it will prove itself and be made into the standard at which time other browsers will have to catch up.

Otherwise, how can progress be made - Microsoft does this all the time: would XMLHttpRequest have ever made it into the standards if Internet Explorer wouldn't have implemented it first?

From the Mozilla perspective the purpose of these changes, except for adding more capabilities for use by web developers, is to lead up to JavaScript 2.0, that is being developed as the next revision of ECMA 262 (revision 4) TC39 workgroup.

Future browsers will support JavaScript 2.0. In the mean time, developers are invited to take advantage of these extra features - natively in Firefox and using JavaScript libraries that provide backward compatibility with Internet Explorer. I find this very useful.

Also, it may be interesting to note that Webkit (the engine developed by KDE and used by Safari, Chrome and several free software browsers) supports JavaScript 1.7.

Guss
You may want to clarify that Chrome has its own JavaScript engine, even though it uses WebKit. I can't think of a non-wordy way to add it.
Matthew Crumley
@Guss - Yeah, I know that Safari and Chrome are at > 1.5, but as long as IE is stuck there then even libraries that provide backward compatibility can just take the simple route and avoid the new features. I understand the need to push technology, I'm just wondering what the path forward is.
David Citron
I believe this is a good path - you need a working implementation of the standard before you pass it through the standard bodies, best if its done in cooperation with the standard bodies.
Guss
FYI: ECMAScript4 (aka JS2.0) is dead - the next revision is 3.1 (mostly clarifications, security and library udates); after that, there'll be ES Harmony (which might be renamed to ES4.0 in the future), but a lot of things which where under discussion for the original ES4 have been scrapped
Christoph
+7  A: 

Firefox, Thunderbird, and other XUL apps also have large portions of themselves written in JavaScript. A more featureful JavaScript means a better development environment for Firefox and other Mozilla apps.

Steven Huwig
Yes I write xul apps and I love taking advantage of Pythonic array comprehension and other advanced features. It's awesome.
apphacker
+2  A: 

The biggest reason at the moment for improved JavaScript is for extension writers, who need not worry about cross-browser compatiblity.

Turnor
A: 

JavaScript is a trademark by Sun which was licensed to Netscape and is now held by the Mozilla Foundation. Microsoft has their own implementation of the language called JScript, but there are others (eg. DMDScript).

ECMAScript was an afterthought to add a common baseline to the various implementations. So it's only natural that language development continues outside the standards committee, which is free to add the changes pioneered by the implementors in future revisions of the standard (eg the array extras introduces in JS1.6 will be in ES3.1).

Christoph
Yeah, I'm aware of the history. I was just wondering who would actually use FF-only extensions and why, since you'd have to write 1.5-compatible code for (at least) IE anyway so you're back to where you started from. Steven's XUL answer is the best so far, though outside the realm of Web pages.
David Citron