JavaScript Implementations - Java Script

Although ECMA Script is an important standard, it is not the only part of JavaScript,and certainly not the only part that has been standardized. Indeed,a complete JavaScript implementation is made up of three distinct parts

  • The Core (ECMAScript)
  • The Document Object Model (DOM)
  • The Browser Object Model (BOM)

JavaScript Implementations


ECMAScriptdoesn’t have ties to any browser in particular and, actually,has no methods for user input or output to speak of.(It is not unlike languages such as C,which rely on external libraries to accomplish such tasks.) So what is ECMAScript?

“ECMAScript can provide core scripting capabilities for a variety of host environments,and therefore the core scripting language is specified...apart from any particular host environment.”

AWeb browser is considered a host environment for ECMAScript,but it is not the only host environment.Indeed,numerous other environments (such as Nombas’s ScriptEase and Macromedia’s ActionScript, used in both Flash and Director MX) can host ECMAScript implementations.So what does ECMAScript specify outside of a browser? To put it simply,ECMAScript describes the following:

  • Syntax
  • Types
  • Statements
  • Keywords
  • Reserved Words
  • Operators
  • Objects

ECMAScript is simply a description,defining all the properties, methods,and objects of a scripting language.Other languages implement ECMAScript,as JavaScript does,as the baseline for functionality.


Each browser has its own implementation of the ECMAScript interface, which is then extended to contain the DOM and BOM There are other languages that also implement and extend ECMAScript such as Windows Scripting Host (WSH), ActionScript in Macromedia Flash and Director,and Nombas ScriptEase.

ECMAScript editions

ECMAScript is separated into editions rather than versions because it is defined in a standard called ECMA-262. Like any standard, ECMA-262 can be edited and updated. When a major update occurs, a new edition of the standard is published. The most recent edition of ECMA-262 is edition 3, released in December of 1999.The first edition of ECMA-262 was essentially the same as Netscape’s JavaScript 1.1 with all browser-specific code removed, but with a few changes.First, ECMA-262 required support for the Unicode Standard (to support multiple languages).Second, it required that objects be platformindependent (Netscape’s JavaScript 1.1 actually had different implementations of objects, such as the Date object, depending on the platform).This was a major reason why JavaScript 1.1 and 1.2 did not conform to the first edition of ECMA-262.

The second edition of ECMA-262 was largely editorial in nature.The standard was updated in order to get into strict agreement with ISO/IEC-16262 and didn’t feature any additions,changes,or omissions.ECMAScript implementations typically don’t use the second edition as a measure of conformance.

The third edition of ECMA-262 was the first real update to the standard. It provides updates to string handling,the definition of errors, and numeric outputs.It also adds support for regular expressions, new control statements, try...catch exception handling,and small changes to better prepare the standard for internationalization. To many, this marked the arrival of ECMAScript as a true programming language.

What does ECMAScript conformance mean?

In ECMA-262, the definition of ECMAScript conformance is laid out. A scripting language must subscribe to four basic tenets:

  • A conforming implementation must support all “types, values, objects, properties, functions, and program syntax and semantics” (ECMA-262, p. 1) as they are described in ECMA-262.<
  • A conforming implementation must support the Unicode Character Standard.
  • A conforming implementation may add “additional types, values, objects, properties, and functions” that are not specified in ECMA-262. ECMA-262 describes these additions as primarily new objects or new properties of objects not given in the specification.
  • A conforming implementation may support “program and regular expression syntax” that are not defined in ECMA-262 (meaning that the built-in regular expression support is allowed to be altered and extended).

All implementations of ECMAScript must be in agreement with these criteria.

ECMAScript support in Web browsers

Netscape Navigator 3.0 shipped with JavaScript 1.1 in 1996.That same JavaScript 1.1 specification was then submitted to the ECMA as a proposal for a new standard.With JavaScript’s explosive popularity, Netscape was very happy to start developing version 1.2.One problem: ECMA hadn’t yet accepted Netscape’s proposal.

A little after Netscape Navigator 3.0 was released, Microsoft introduced Internet Explorer 3.0. This version of IE shipped with JScript 1.0 (Microsoft’s name for its JavaScript implementation), which was supposed to be equivalent to JavaScript 1.1. However, because of undocumented and improperly replicated features, JScript 1.0 fell far short of JavaScript 1.1.

Netscape Navigator 4.0 was shipped in 1997 with JavaScript 1.2 before the first edition of ECMA-262 was finalized;ECMA-262 was accepted and standardized later that year. As a result, JavaScript 1.2 is not compliant to the first edition of ECMAScript, even though ECMAScript was supposed to be based on JavaScript 1.1.

The next update to JScript occurred in Internet Explorer 4.0 with version JScript 3.0(version 2.0 was released in Microsoft’s Internet Information Server version 3.0 but was never included in a browser).Microsoft put out a press release touting JScript 3.0 as the first truly ECMA-compliant scripting language in the world. At that time, ECMA-262 hadn’t yet been finalized, so JScript 3.0 suffered the same fate as JavaScript 1.2: It did not comply with the final ECMAScript standard.

Netscape opted to update its JavaScript implementation in Netscape Navigator 4.06. JavaScript 1.3 brought Netscape into full compliance with ECMAScript Edition 1.Netscape added support for the Unicode standard and made all objects platform-independent while keeping the features that were introduced in JavaScript 1.2.

When Netscape released its source code to the public as the Mozilla project,it was anticipated that JavaScript 1.4 would be shipped with Netscape Navigator 5.0. However, a radical decision to completely redesign the Netscape code from the bottom up threw a monkey wrench into the works. JavaScript 1.4 was only released as a server-side language for the Netscape Enterprise Server and never made it into a Web browser.

Today, all popular Web browsers comply with the third edition of ECMA-262. The following table lists ECMAScript support in the most popular Wed browsers:

ECMAScript complianceECMAScript compliance

The Document Object Model (DOM)

The Document Object Model (DOM) is an application programming interface (API) for HTML as well as XML. The DOM maps out an entire page as a document composed of a hierarchy of nodes. Each part of an HTML or XML page is a derivative of a node. Consider the following HTML page:

This code can be diagrammed into a hierarchy of nodes using the DOM .

hierarchy of nodes using the DOM .

By creating a tree to represent a document, the DOM allows developers an unprecedented level of control over its content and structure. Nodes can easily be removed, added, and replaced by using the DOM API.

Why the DOM is necessary

With Internet Explorer 4.0 and Netscape Navigator 4.0 each supporting different forms of Dynamic HTML (DHTML),developers for the first time could alter the appearance and content of a Web page without reloading it.This represented a tremendous step forward in Web technology,but also a huge problem.Netscape and Microsoft each went its own way in developing DHTML,thus ending the period when Web developers could write a single HTML page that could be accessed by any Web browser.

It wasdecided that something had to be done to preserve the cross-platform nature of the Web.The fear was that,if someone didn’t rein in Netscape and Microsoft,the Web would develop into two distinct factions that were exclusive to targeted browsers.It was then that the World Wide Web Consortium (W3C),the body charged with creating standards for Web communication,began working on the DOM.

DOM levels

DOM Level 1 became a W3C recommendation in October of 1998.It consisted of two modules:the DOM Core,which provided a way to map the structure of an XML-based document to allow for easy access to and manipulation of any part of a document, and the DOM HTML,which extended the DOM Core by adding HTML-specific objects and methods.

Whereas DOM Level 1’s only goal was to map out the structure of a document,DOM Level 2’s aims were much broader. This extension to the original DOM added support for mouse and user interface events (long supported by DHTML),ranges, traversals (methods to iterate over a DOM document),and support for Cascading Style Sheets (CSS) through object interfaces.The original DOM Core introduced in Level 1 was also extended to include support for XML namespaces.

DOM Level 2 introduced several new modules of the DOM to deal with new types of interfaces:

  • DOM Views — describes interfaces to keep track of the various views of a document (that is, the document before CSS styling and the document after CSS styling)
  • DOM Events — describes interfaces for events
  • DOM Style — describes interfaces to deal with CSS-based styles
  • DOM Traversal and Range — describes interfaces to traverse and manipulate a document tree DOM Level 3 further extends the DOM with the introduction of methods to load and save documents in a uniform way (contained in a new module called DOM Load and Save) as well as methods to validate a document (DOM Validation). In Level 3, the DOM Core is extended to support all of XML 1.0, including XML Infoset, XPath, and XML Base.

Other DOMs

Aside from the DOM Core and DOM HTML interfaces,several other languages have had their own DOM standards published.The languages are XML-based and each DOM adds methods and interfaces unique to that language:

  • Scalable Vector Graphics (SVG) 1.0
  • Mathematical Markup Language (MathML) 1.0
  • Synchronized Multimedia Integration Language (SMIL)

Additionally,other languages have developed their own DOM implementations,such as Mozilla’s XML User Interface Language (XUL).However,only the languages in the preceding list are standard recommendations from W3C.

DOM support in Web browsers

The DOM was already a standard for some time before Web browsers started implementing it.Internet Explorer took first stab in version 5.0,but it actually didn’t have any realistic DOM support until version 5.5, when it implemented most of DOM Level 1.Internet Explorer hasn’t introduced new DOM functionality since that time.

For Netscape,no DOM support existed until Netscape 6 (Mozilla 0.6.0) was introduced.To date, Mozilla has the best support for the DOM, implementing all of Level 1,nearly all of Level 2, and some parts of Level 3.(The goal of the Mozilla development team was to build a 100% standards-compliant browser,and their work paid off.)

Latecomers such as Opera,which didn’t add DOM support until version 7.0,and Safari, which has implemented most of DOM Level 1,are mostly on par with Internet Explorer 5.5; and in some cases,they exceed it.However,all the browsers are still a distant second to Mozilla as far as DOM support goes.The following fidure shows DOM support for popular browsers:

DOM support for popular browsers

The Browser Object Model (BOM)

The Internet Explorer 3.0 and Netscape Navigator 3.0 browsers feature a Browser Object Model (BOM) that allows access and manipulation of the browser window. Using the BOM,developers can move the window, change text in the status bar, and perform other actions that do not directly relate to the page content. What makes the BOM truly unique, and often problematic, is that it is the only part of a JavaScript implementation that has no related standard.

Primarily, the BOM deals with the browser window and frames, but generally any browser-specific extension to JavaScript is considered to be a part of the BOM. Such things include:

  • The capability to pop up new browser windows.
  • The capability to move,resize,and close browser windows.
  • The navigator object,which provides detailed information about the Web browser.
  • The location object,which gives detailed information about the page loaded in the browser.
  • The screen object,which gives detailed information about the user’s screen resolution.
  • Support for cookies.
  • Internet Explorer extends the BOM to include the ActiveXObject class, which can be used to instantiate ActiveX objects through JavaScript.

Because no standards exist for the BOM, each browser has its own implementation.There are some defacto standards,such as having a window object and a navigator object,but each browser defines its ownproperties and methods for these and other objects.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Java Script Topics