1.1 introduction

This chapter briefly reviews the history of JavaScript and introduces the implementation of JavaScript (what JavaScript is made of).

1.2 MIND

1.3 JavaScript history Review

In 1995, Netscape engineer Brendan Eich was developing a scripting language called Mocha (later renamed LiveScript) for the upcoming Release of Netscape Navigator 2.

In time for release, Netscape formed a development alliance with Sun to work on LiveScript. Just before Netscape 14 Navigator 2 was officially released, Netscape changed the name of LiveScript to JavaScript to ride the wave of media hype surrounding Java.

Due to the success of JavaScript 1.0, Netscape released version 1.1 in Netscape Navigator 3. Then old rival Microsoft released IE3 with its own JavaScript implementation called JScript (so called to avoid a licensing dispute with Netscape).

As a result of Microsoft’s entry, two different versions of JavaScript exist simultaneously, JavaScript in Netscape Navigator and JScript in IE.

In 1997, JavaScript 1.1 was submitted as a proposal to the European Computer Manufacturers Association (Ecma). Technical Committee 39 (TC39) was tasked with “standardizing the syntax and semantics of a common, cross-platform, vendor-neutral scripting language” (see TC39-ECMAScript). The TC39 committee is made up of engineers from Netscape, Sun, Microsoft, Borland, Nombas, and other companies interested in the scripting language. They spent months building ecMA-262, or ECMAScript (pronounced “Ek-MA-script”), a new scripting language standard.

In 1998, the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) also adopted ECMAScript as a standard (ISO/IEC-16262).

1.4 JavaScript implementation

While JavaScript and ECMAScript are basically synonyms, JavaScript is much more than what ecMA-262 defines. A complete JavaScript implementation consists of the following parts:

  • Core (ECMAScript) is defined by ECMA-262 and provides core functionality
  • The Document Object Model (DOM) provides methods and interfaces for interacting with web content
  • The Browser Object Model (BOM) provides methods and interfaces for interacting with the browser

1.4.1 ECMAScript

ECMAScript, the language defined by ECMA-262, is not limited to Web browsers, which are just one possible host environment for ECMAScript implementations. The host environment provides the baseline implementation of ECMAScript and the extensions necessary to interact with the environment itself. Extensions (such as DOM) use ECMAScript core types and syntax to provide additional functionality specific to the environment. Other hosting environments include node.js, the server-side JavaScript platform, and Adobe Flash, which will soon be phased out.

ECMAScript currently has 11 editions (10 at the time of writing), with version 6, commonly known as ES6, ES2015, or ES Harmony, released in June 2015. This release contains perhaps the most important set of enhancements to the specification ever. ES6 officially supports classes, modules, iterators, generators, arrow functions, contracts, reflections, proxies, and numerous new data types.

1.4.2 DOM

The DOM (Document Object Model) is an application programming interface (API) for using extended XML in HTML. DOM abstracts the entire page as a set of hierarchical nodes. Each component of an HTML or XML page is a kind of node that contains different data. Using the DOM API, you can easily remove, add, replace, and modify nodes.

1.4.2.1 DOM necessity

To avoid developing Web pages for browsers, the World Wide Web Consortium (W3C) has developed the DOM standard.

1.4.2.2 DOM level

1.4.3 BOM

Internet Explorer 3 and Netscape Navigator 3 provide a Browser Object Model (BOM) API for enabling access to and manipulation of the browser’s Windows. Using the BOM, developers can control what the browser displays outside of the page. What’s really unique about BOM, and certainly most problematic, is that it’s the only JavaScript implementation that doesn’t have a standard.

BOM is for browser Windows and frames and includes browser-specific extensions such as:

  • Ability to pop up a new browser window
  • The ability to move, zoom, and close browser Windows
  • A navigator object that provides detailed information about the browser
  • Location object that provides detailed information about the page the browser loaded
  • Screen object that provides detailed information about the user’s screen resolution
  • Performance object that provides detailed information about browser memory usage, navigation behavior, and time statistics
  • Support for cookies
  • Other custom objects, such as XMLHttpRequest and IE’s ActiveXObject