The three main components of JavaScript

Source: Internet
Author: User

core (ECMAScript)
Document Object Model (DOM)
Browser Object Model (BOM)

core (ECMAScript)

ECMAScript is not tied to any specific browser, and in fact it does not mention a method for any user input and output (this differs from a language such as C, which relies on external libraries to accomplish such tasks). So what is ECMAScript? The ECMA-262 standard (2nd paragraph) is described as follows:

"ECMAScript can provide core scripting capabilities for different kinds of hosting environments, so the core scripting language is defined separately from any particular hosting environment ..."

A Web browser is a hosting environment for ECMAScript, but it is not the only hosting environment. In fact, there are countless other environments (such as Nombas's scriptease, and ActionScript that Macromedia uses in both Flash and Director MX) to accommodate ECMASCRIPT implementations. So what does ECMAScript prescribe outside of the browser?

To put it simply, ECMAScript describes the following:

    • Grammar
    • Type
    • Statement
    • Key words
    • Reserved words
    • Operator
    • Object

ECMAScript is just a description that defines all the properties, methods, and objects of the scripting language. Other languages can implement ECMAScript as a benchmark for functionality, as JavaScript does:

Each browser has its own implementation of the ECMAScript interface, which is then expanded to include both the DOM and the BOM. Of course there are other implementations and extensions of ECMAScript languages, such as Windows Script Host (Windows Scripting Host, WSH), ActionScript Macromedia in Flash and Director MX, and Nombas Scriptease.

Document Object Model (DOM)

The DOM (Document Object model) is an application interface (API) for HTML and XML. The DOM will plan the entire page into a document composed of node hierarchies. Each part of an HTML or XML page is a derivative of a node. Please consider the following HTML page:

This code can be drawn as a node-level graph using the DOM:

Browser object Model (BOM)

IE 3.0 and Netscape Navigator 3.0 provide a feature-BOM (Browser object model) that can be accessed and manipulated in a browser window. Using the BOM, developers can move the window, change the text in the status bar, and perform other actions that are not directly related to the content of the page. What makes a BOM unique and often questionable is that it is just a part of JavaScript and does not have any relevant standards.

The BOM mainly deals with browser windows and frames, but usually browser-specific JavaScript extensions are considered part of the BOM. These extensions include:

    • Pop up a new browser window
    • Move, close, and resize a browser window
    • Anchor object that provides details about the Web browser
    • Screen object that provides detailed information about the user's screen resolution
    • Support for Cookies
    • IE expands the BOM, joins the ActiveXObject class, and can instantiate ActiveX objects through JavaScript

Because there is no relevant BOM standard, each browser has its own BOM implementation. There are some de facto criteria, such as having a Window object and a navigation object, but each browser can define its own properties and methods for those objects or other objects.

The three main components of JavaScript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.