Section 1.1. Twisted History: Specs and Implementations


1.1. Twisted History: Specs and Implementations

Learning a programming language doesn't require learning its historyunless you're a language like JavaScript, whose history is reflected in web pages today.

JavaScript originated with Netscape, back when it was first developing its LiveConnect server-side development. The company wanted a scripting language that could interface with the server-side components and created one called "LiveScript." Later, after an initial partnership with Sun, owner of the Java programming language, the Netscape engineers renamed LiveScript to JavaScript, even though there was and is no connection between either programming language. Well-known JavaScript guru Steven Champeon wrote:

Rewind to early 1995. Netscape had just hired Brendan Eich away from MicroUnity Systems Engineering, to take charge of the design and implementation of a new language. Tasked with making Navigator's newly added Java support more accessible to non-Java programmers, Eich eventually decided that a loosely typed scripting language suited the environment and audience, namely the few thousand web designers and developers who needed to be able to tie into page elements (such as forms, or frames, or images) without a bytecode compiler or knowledge of object-oriented software design.

The language he created was christened "LiveScript," to reflect its dynamic nature, but was quickly (before the end of the Navigator 2.0 beta cycle) renamed JavaScript, a mistake driven by marketing that would plague web designers for years to come, as they confused the two incessantly on mailing lists and on Usenet. Netscape and Sun jointly announced the new language on December 4, 1995, calling it a "complement" to both HTML and Java.

(From "JavaScript: How Did We Get Here?" O'Reilly Network, April 2001.)

Not to be out-engineered, Microsoft countered Netscape's effort with the release of Internet Explorer and its own scripting languageVBScriptderived from the company's popular Visual Basic. Later, it also released its own version of a JavaScript-like language: JScript.

The competition between browsers and languages impacted the early adoption of JavaScript within many companies, especially as the difficult challenge of maintaining cross-browser compatible pages increasednot to mention confusion about the name.

In an effort to cut through the compatibility issues, Netscape submitted the JavaScript specification to the European Computer Manufacturer's Association (ECMA) International in 1996, to reissue it as a standardized work. Engineers from Sun, Microsoft, Netscape, and other companies holding a stake in the language were invited to participate, and the result was the release of the first ECMAScript specificationECMA-262in June 1997. Since that time, most companies that support a version of JavaScript (or JScript or ECMAScript) have agreed to, at a minimum, support ECMA-262.

You can download a PDF of ECMA-262 at http://www.ecma-international.org/publications/standards/Ecma-262.htm. It's not exciting reading, but it does make a good companion reference.


The second version of ECMA-262 was strictly a maintenance release. The third, and current, version was released in December 1999.

However, this wouldn't be JavaScript if the confusion ended with the passing of ECMA-262. Scattered about the Web is discussion of a new version of ECMAScript, designated ECMA-357. However, this isn't a new edition or version of ECMAScript; it's an extension known as E4X. The purpose of the extension is to add native XML capability to ECMA-262. ECMA-357 was published in 2004, and at this time, JavaScript 1.6 has partially implemented E4X.

What's important to remember from all of this is that many of these older versions of scripting langauges are still in use, even today. It's not uncommon to find old JScript or the earliest versions of JavaScript. To clarify all the versions of scripting languages and how they relate to one another, Table 1-1 provides an approximate correspondence between JavaScript, JScript, and ECMAScript version, and what version of each is supported by today's most popular web browsers.

Table 1-1. Script support in browsers
BrowserScript support Documentation URL
Internet Explorer 6.x ECMA-262 (v3) /JScript 5.6 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/1e9b3876-3d38-4fd8-8596-1bbfe2330aa9.asp
Internet Explorer 7.x (Windows XP)ECMA-262 (v3) /JScript 5.6 http://msdn.microsoft.com/ie/
Opera 8 and 8.5ECMA-262 (v3) /JavaScript 1.5 http://www.opera.com/docs/specs/js/ecma/
Firefox 1.5ECMA-262 (v3) with partial support for ECMA-357 (E4X) /JavaScript 1.6 JavaScript 1.5 core reference: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference/JavaScript 1.6 core reference: http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6
Safari 2.x on TigerECMA-262 (v3) http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSProgTopics/index.html
Camino 1.0ECMA-262 (v3) /JavaScript 1.5 http://www.caminobrowser.org/
Netscape 8.1ECMA-262 (v3) /JavaScript 1.5 http://browser.netscape.com/ns8/
Various wireless device browsersVariesSite that contains reference to several emulators and testing tools: http://www.wirelessdevnet.com/channels/printlinks.phtml?category=4


When you're visiting web pages and curious as to how they implement a specific feature, you can usually tell what version of JavaScript they're using by how they declare the script block. In addition, there are pieces of these old languages that still influence the more modern versions of JS. We'll look more closely at the script block later in this chapter, and at the influences of older browsers throughout the book, but it's important to be aware that old versions of JavaScript and its variations still impact today's applications.

Throughout the book, I use both JavaScript and JS interchangeably. In addition, unless otherwise noted, examples in this book are based on EMCA-262 and JavaScript 1.5/1.6.





Learning JavaScript
Learning JavaScript, 2nd Edition
ISBN: 0596521871
EAN: 2147483647
Year: 2006
Pages: 151

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net