What falls under the ECMAScript scope?
Among other things, ECMAScript defines:
- The language syntax (parsing rules, keywords, control flow, object literal initialization...)
- Error handling mecanisms (throw, try/catch, ability to create user-defined Error types)
- Types (boolean, number, string, function, object...)
- The global object. In a browser environment, this global object is the window object. A couple of functions are attached to this object (parseInt, parseFloat, decodeURI, encodeURI...)
- A prototype-based inheritance mechanism
- Built-in objects and functions (JSON, Math, Array.prototype methods, Object introspection methods...)
- Strict mode
Historically, ECMAScript features were supported well and in an interoperable manner. As of March 2011, differences between implementations can be found in ECMAScript 5 support. Some resources document ECMAScript 5 browser support.
The next version of ECMAScript is named "Harmony". It defines things like Proxies or the
const keyword. Progress can be followed here.
The DOM (Document Object Model)
The Document Object Model is standardized by the W3C. It defines language-agnostic interfaces which abstract HTML and XML documents as objects and mechanisms to manipulate this abstraction. Among the things defined by the DOM, we can find:
- DOM events with the DOM Event Architecture and interfaces such as Event, EventTarget, DocumentEvent...
- Other things such as DOM traversal
From the ECMAScript point of view, objects defined in the DOM specification are called "host objects".
The WebIDL specification aims at providing a normalized ECMAScript binding to the DOM in terms of ECMAScript 5.
Other features are defined outside of the DOM and ECMAScript. Some weren't standardized until the WHATWG started to list these features and add them to the HTML5 spec. They are now standardized by the WHATWG, W3C or both.
These functions which really aren't browser specific have been first specified in HTML Standard as part of WindowTimers.
DOM is an abstraction that is common to XML and HTML documents. However, HTML has some rules, restrictions and semantics that aren't true with XML (limited number of element names, limited number of attributes, rules of element inclusion like the fact that within a <ul> element, there can only be <ul> elements). HTML DOM abstracts these specificities. Most of this document content is being redefined in the HTML Standard specification in order to standardize what is actually in web browsers.
Other notable APIs
- XMLHttpRequest. API allowing to send asynchronous HTTP request.Standardized by the W3C.
- CSS Object Model. The CSSOM is used to abstract CSS rules as objects. Standardized by the W3C.
- WebWorkers. API that allows parallel computation. Standardized by the WHATWG
- WebSockets. API that allow low-level bidirectional communication. Standardized by the W3C
- Canvas 2D Context. Drawing API for the canvas element. Standardized by the W3C.
DOM and BOM browser support
Every web developer has experienced that the DOM is a mess. It is roughly the same for the BOM. Browser support uniformity varies a lot form feature to feature. This is mostly due to the fact that DOM and BOM features haven't been standardized right away and web browsers have added features for overlapping use cases (like the Internet Explorer event model). The current (March 2011) trend is, from the specification point of view (WHATWG, W3C) to catch up on features which are in browsers and from the browser point of view to catch up on specifications and good ideas of other browsers.