Section I.10. ECMAScript


I.10. ECMAScript

When Navigator 2 made its debut, it provided built-in client-side scripting with a new language called JavaScript. Despite what its name might imply, the language was developed at Netscape, originally under the name LiveScript. It was a marketing alliance between Netscape and Sun Microsystems that put "Java" into the JavaScript name. Yes, there are some striking similarities between the syntax of JavaScript and Java, but those existed even before the name changed.

Internet Explorer 3 introduced client-side scripting for that browser. Microsoft provided language interpreters for two languages: VBScript, with its syntax based on Microsoft's Visual Basic language, and JScript, which, from a compatibility point of view, was virtually 100% compatible with JavaScript in Navigator 2. The name variation had more to do with licensing and corporate politics than it did with programming syntax.

It is important to distinguish a programming language, such as JavaScript, from the document object model that it scripts. It is too easy to forget that document objects are not part of the JavaScript language, but are rather the "things" that programmers script with JavaScript (or VBScript). The JavaScript language is actually more mundane in its scope. It provides the nuts and bolts that are needed for any programming language: data types, variables, control structures, and so on. This is the core JavaScript language.

From the beginning, JavaScript was designed as a general-purpose language that could be applied to any object model, and this has proven useful. Adobe Systems, for example, uses JavaScript as the core scripting language for many of its imaging and publishing products. The same core language you use in HTML documents is applied to completely different object models in the Adobe programs.

To head off potentially disastrous incompatibilities between the implementations of core JavaScript in different browsers, several concerned parties (including Netscape and Microsoft) worked with a European computer standards group now known only by its acronym: ECMA. The first published standard, ECMA-262 (http://www.ecma.ch/stand/ecma-262.htm), also known as the politically neutral ECMAScript, is essentially the version of JavaScript found in Navigator 3. A second edition of the standard repaired small errors in the first edition. But the third edition added some new language features that had already been implemented in cross-browser compatible fashion. That version of ECMAScript has essentially been a part of mainstream browsers since 1998. More recent browsers implement features of the core language that will find their way into future versions of the standard.

The language continues to evolve and even branch into new areas. For example, Mozilla 1.8 was the launchpad for support for a related standard, ECMA For XML, or E4X for short. These extensions simplify working with XML data within scripts by filling in some of the practical gaps left by the DOM standard.

The good news for scripters is that browsers such as IE, Mozilla, Safari, and Opera display a high degree of cross-browser compatibility with respect to the core ECMA-based scripting language. After the dissonance in the object model arena, it is comforting for web authors to see so much harmony in the core language implementation. For the objects and syntax of the core JavaScript language, see Chapter 5 of Dynamic HTML: The Definitive Reference, Third Edition.




Dynamic HTML. The Definitive Reference
Dynamic HTML: The Definitive Reference
ISBN: 0596527403
EAN: 2147483647
Year: 2004
Pages: 120
Authors: Danny Goodman

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