Home > Article > Web Front-end > What are the main parts of javascript?
Javascript is mainly composed of 3 parts: 1. ECMAScript, which describes the basic syntax and data types of the language; 2. Document Object Model (DOM), which is the application programming interface of HTML and XML; 3. Browsing The browser object model (BOM), which accesses and operates the browser window.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Although JavaScript and ECMAScript are often used to express the same meaning, JavaScript has much more meaning than what is specified in ECMA-262. A complete JavaScript implementation should be composed of three parts:
Core (ECMAScript)
Document Object Model (DOM)
Browser Object Model (BOM)
1. ECMAScript:
The core of JavaScript, describes the language Basic syntax (var, for, if, array, etc.) and data types (numbers, strings, Boolean, functions, objects (obj, [], {}, null), undefined), ECMAScript is a set of standards that define What a language (such as JS) looks like.
2. Document Object Model (DOM):
DOM (Document Object Model) is the application programming interface (API) of HTML and XML. DOM will lay out the entire page into a document composed of node hierarchies. Each part of an HTML or XML page is a derivative of a node.
DOM represents a document by creating a tree, giving developers unprecedented control over the content and structure of the document. Nodes can be easily removed, added and replaced using the DOM API (getElementById, childNodes, appendChild, innerHTML).
DOM Level
DOM1
DOM Core How to map XML-based document structure
DOM html Added objects for html And method
DOM2
expands mouse and user interface events, range, traversal and other subdivision modules, and adds support for css through the object interface.
The details are as follows:
DOM view: defines the interface for tracking different document views
DOM event: defines the event and event handling interface
DOM style: defines an interface for operating element styles based on css
DOM traversal and scope: a. Definition An interface for traversing and operating the document tree has been added b. A new method for validating documents has been added
DOM3
Introduced loading and saving in a unified manner Document method
3. Browser Object Model (BOM):
The Browser Object Model (BOM) accesses the browser window and operations.
Function
Handling browser windows and frames
JS extension for browser operations
Specific functions
The function of popping up a new browser window
The function of moving, zooming and closing the browser window
The navigator object that provides detailed information about the browser
The location object that provides detailed information about the page loaded by the browser
A screen object that provides detailed information about the user's monitor resolution
Support for cookies
XMLHttpRequest -- ActiveXObject
For example: pop up a new browser window, move, change and close the browser window, provide detailed web browser information (navigator object), detailed page information (location object), detailed User screen resolution information (screen object), support for cookies, etc.
As a part of JavaScript, BOM does not have the support of relevant standards. Each browser has its own implementation. Although there are some non-de facto standards, it still brings certain troubles to developers.
[Related recommendations: javascript learning tutorial]
The above is the detailed content of What are the main parts of javascript?. For more information, please follow other related articles on the PHP Chinese website!