Chapter One introduction to JavaScript--advanced programming of JavaScript

Source: Internet
Author: User
Tags hosting

JavaScript was born in 1995. Its primary purpose at the time was to handle some of the input validation operations previously held by the server-side language.

Today's JavaScript is no longer confined to simple data validation, but rather has the ability to interact with almost all aspects of the browser window and its content.

Today's JavaScript has become a full-fledged programming language capable of handling complex computations and interactions, with features such as closures, Anonymous (lambda, LAMDA) functions, and even meta-programming.

European Association of Computer Manufacturers (Ecma,european Computer Manufacturers Association)

ISO/IEC (International Organization for Standardization and International Electrotechnical Commission, GB Standardization Organization and International Electrotechnical Commission)

First, JavaScript implementation

A complete JavaScript implementation should consist of the following three different parts:

(1) core (ECMAScript)

(2) Document Object Model (DOM)

(3) Browser object Model (BOM)

1, ECMAScript

The ECMAScript defined by ECMA-262 has no dependencies on the Web browser. In fact, the language itself does not contain input and output definitions. ECMA-262 defines only the basis of this language, and on top of that it builds a more complete scripting language.
Our common web browser is just one of the possible hosting environments for ECMAScript implementations. The hosting environment not only provides a basic ECMAScript implementation, but also provides an extension of the language for the interface between the language and the environment. These extensions, such as DOM, use the core type and syntax of ECMAScript to provide more specific functionality to enable operations against the environment. Other hosting environments include node (a server-side JavaScript platform) and Adobe Flash.

The ECMA-262 standard stipulates the following components:

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

ECMAScript is a description of the language that implements all aspects of the standard's provisions. JavaScript implements the Ecmascript,adobe ActionScript as well as the ECMAScript.

2. Document Object Model (DOM)

The Document Object model (Dom,document object models) is an application programming interface (Api,application programming Interface) for XML but extended for HTML. The DOM maps the entire page into a multi-tiered node structure.

This tree-shaped representation of the document, created by DOM, provides the developer with the initiative to control the content and structure of the page. With the API provided by the DOM, developers can easily delete, add, replace, or modify any node.

The DOM1 level consists of two modules: the DOM core (DOM cores) and the Dom HTML. The DOM core specifies how the XML-based document structure is mapped to
Simplifies access and manipulation of any part of the document. Dom HTML modules are expanded on the basis of the DOM core, adding objects and methods for HTML.

The goal of the DOM1 class is to map the structure of the document, so the goal of the DOM2 level is much broader. The DOM2 level also expands on the original Dom (DHTML has always supported) the mouse and user interface events, scopes, traversal (methods of iterating DOM documents) and other subdivision modules, and through the object interface added to the CSS (cascading Style Sheets, Cascading style sheets) is supported. The DOM core modules in the DOM1 class are also extended to support XML namespaces.
The DOM2 class introduces the following new modules, as well as the definition of many new types and new interfaces.

    • Dom View (DOM views): Defines an interface that tracks different documents (for example, documents before and after applying CSS);
    • DOM Event (DOM events): Defines the interface for event and event handling;
    • Dom Style: Defines an interface that applies styles to elements based on CSS;
    • DOM Traversal and range (DOM traversal and Range): Defines the interfaces that traverse and manipulate the document tree.

The DOM3 class extends the DOM further, introducing a way to load and save documents in a uniform way-defined in DOM load and save (DOM load and save) modules, and new methods for validating documents-defined in DOM validation (DOM Validation) modules. The DOM3 class also extends the DOM core and begins to support the XML 1.0 specification, involving XML Infoset, XPath, and XML Base.

In addition to the DOM core and Dom HTML interfaces, several other languages have published only their own DOM standards. The languages listed below are XML-based, and the DOM standards for each language add new methods and interfaces related to specific languages:

    • SVG (Scalable vector Graphic, Scalable vector) 1.0;
    • MathML (mathematical Markup Language, Mathematical Markup Language) 1.0;
    • SMIL (Synchronized Multimedia integration Language, Synchronized Multimedia integrated language).

Some languages have also developed their own DOM implementations, such as Mozilla's XUL (XML user Interface Language,xml UI language). However, only a few of the languages listed above are recommended by the consortium.

3. Browser object Model (BOM)

Browser object Model (Bom,browser)

Developers use the BOM to control parts of the page that the browser displays.

Fundamentally, the BOM only handles browser windows and frames; But people are also accustomed to extending all of the browser-specific javascript
Counted as part of the BOM. Here are some of these extensions:

    • Popup new browser window function;
    • The ability to move, zoom, and close the browser window;
    • A Navigator object that provides detailed browser information;
    • A Location object that provides detailed information about the page loaded by the browser;
    • A screen object that provides detailed information about the user's display resolution;
    • (a) Support for cookies;
    • Custom objects such as the activexobject of XMLHttpRequest and IE.

Since there is no BOM standard to follow, each browser has its own implementation. While there are some fact criteria, such as the Window object and the Navigator object, each browser defines its own properties and methods for both objects and even other objects.

Chapter One JavaScript Introduction-JavaScript Advanced programming

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.