Talk is cheap,show me your code.
The history of JavaScript
In 1995, Netscape Company's Brenda Eich for Netscape Navigator 2 began developing a scripting language called LiveScript (also used in the browser and server, on the server named Livewire). In order to complete the development on schedule, Netscape and Sun Company established a development alliance.
On the eve of the release of Netscape Navigator 2 in 1996, Netscape temporarily renamed LiveScript as JavaScript for the heat of the rub. Because JavaScript 1.0 has been hugely successful, Netscape has released JavaScript 1.1 in Netscape Navigator3. Microsoft added a scripting language called JScript in IE3 (which was named to circumvent Netscape-related licensing issues, when JScript was developed based on Netscape JavaScript 1.0), when JavaScript had two different versions.
In 1997, the recommendation to define JavaScript standards in JavaScript 1.1 was presented to the ECMA (European Association of Computer manufacturers). The ECMA Designation 39th Technical Committee (TC39, composed of programmers from Netscape, Sun, Microsoft, Borland, etc.) is responsible for standardizing the syntax and semantics of a common, cross-platform, vendor-neutral scripting language. TC39 the standard for ecma-262--to define a new scripting language called ECMAScript, which has been completed for several months.
In 1998, ISO/IEC (International Organization for Standardization and Electrotechnical Commission) also adopted ECMAScript as the standard (i.e. iso/iec-16262). Since then, ECMAScript has become the basis for browser developers to implement JavaScript on their own.
Implementation of JavaScript
A complete JavaScript implementation consists of the core (ECMAScript), the Document Object Model (DOM), and the browser object model (BOM).
ECMAScript
The ECMAScript defined by ECMA-262 does not contain input and output definitions, ECMA-262 defines only the basis of ECMAScript, on which a more complete scripting language can be built.
ECMAScript's hosting environment includes not only Web browsers, but also node (the server-side JavaScript platform) and Adobe Flash. The hosting environment not only provides a basic ECMAScript implementation, but also provides an extension to the language to interface with the environment. These extensions take advantage of ECMAScript's core types and syntax to provide more and more specific functionality in order to implement actions for the environment.
ECMA Rules Content
ECMAScript is a description of the language that implements the various aspects of the standard's provisions, which in general prescribe the following components of the language:
- Grammar
- Type
- Statement
- Key words
- Reserved words
- Operator
- Object
ECMAScript version
- ECMA-262 1th Edition is essentially the same as the Netscape JavaScript 1.1, except that all browser-specific code is removed and minor changes are made (Unicode support is supported for multi-language development and the object becomes platform-independent).
- The ECMA-262 2nd edition is updated to maintain strict consistency with iso/iec-16262 without any new, modified, or deleted processing.
- ECMA-262 3rd is the first real modification, which modifies string processing, error definitions, and numeric output, and adds support for regular, new control statements, Try-catch, and other minor modifications. The 3rd edition of the logo ECMAScript becomes a true programming language.
- ECMA-262 the 4th edition of a comprehensive review of the revision, the new standard contains not only strongly typed variables, new statements and new data structures, real classes and classic inheritance, but also defines a new way of data interaction. The ECMA-262 4th edition was abandoned on the eve of the release, as it spanned too much.
- The 5th edition of ECMA-262, derived from version 3rd, seeks to clarify known ambiguities in the 3rd edition and adds new features (including native JSON objects, inherited methods, and advanced attribute definitions), as well as a rigorous pattern that complements the ECMAScript engine interpretation and execution code. The 5th edition of ECMA-262 was originally ECMAScript 3.1, due to the less-improved version of the 4th version of the 3rd edition that spanned too large and another design.
ECMAScript compatible
To be an implementation of ECMAScript, the implementation must do the following:
- Supports all types, values, objects, properties, functions, and program syntax and semantics described by ECMA-262
- Supports Unicode character standard
The following extensions are also available for compatible implementations:
- Add a type, value, object, property, function that is not described by ECMA-262, primarily a new property of new objects and objects that are not specified in the standard
- Supports ECMA-262 without defined program and regular expression syntax
Browser support for ECMAScript
Browser |
ECMAScript compatibility |
Netscape Navigator 2 |
- |
Netscape Navigator 3 |
- |
Netscape Navigator 4~4.05 |
- |
Netscape Navigator 4.06~4.79 |
1th Edition |
Netscape 6+ (Mozilla 0.6.0+) |
3rd Edition |
IE 3 |
- |
IE 4 |
- |
IE 5.5~7 |
3rd Edition |
IE 8 |
Version 5th (not fully compatible) |
IE + + |
5th Edition |
Opera 6~7.1 |
2nd Edition |
Opera 7.2+ |
3rd Edition |
Safari 1~2.0.x |
Version 3rd (not fully compatible) |
Safari 3.x |
3rd Edition |
Safari 4.x~5.x |
Version 5th (not fully compatible) |
Chrome 1+ |
3rd Edition |
Firefox |
3rd Edition |
Firefox 3.0.x |
3rd Edition |
Firefox 3.5~3.6 |
Version 5th (not fully compatible) |
Firefox 4.0+ |
5th Edition |
Document Object Model DOM
The DOM (Document Object Model) is an API (application programming interface) that is intended for XML but is extended for HTML.
The DOM maps the entire page into a multi-tiered node structure, where each component of an HTML or XML page is a node of a certain type, and the nodes contain various types of data. With the API provided by the DOM, developers can easily delete, add, replace, or modify any node.
Because IE4 and Netscape Navigator 4 support different forms of DHTML (Dynamic HTML), which adds to the burden of developers making code compatible with different browsers, the World Wide Web Consortium, which is responsible for developing the Internet Protocol, has developed the DOM specification, Dom Level 10% is the recommended standard for the consortium.
DOM level
- DOM Level 1 consists of Dom core, which specifies how to map an XML-based document structure, and Dom HTML, which adds objects and methods for HTML to the core.
- DOM Level 2 expands the mouse and user interface events, scopes, traversal and other subdivision modules on the original basis, and adds support for the CSS through the object interface.
- DOM Level 3 Further expands the DOM, introduces a way to load saved documents in a uniform way, adds a way to validate the document, expands the DOM core, and starts supporting the XML 1.0 specification.
- DOM Level 0 does not exist, it is just a reference point, that is, IE4 and Netscape Navigator 4 originally supported DHTML.
Other 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 image) 1.0
- MathML (Mathematical Markup Language) 1.0
- SMIL (Synchronized Multimedia Integrated language)
XUL (XML user interface language) has also developed its own DOM implementation, but it has not become a recommended standard.
Web browser support for DOM
Browser |
DOM Compatibility |
Netscape Navigator 1.x~4.x |
- |
Netscape 6+ (Mozilla 0.6.0+) |
Class 1, Level 2 (almost all), Level 3 (partial) |
IE 2~4.x |
- |
IE 5 |
Level 1 (minimum) |
IE 5.5~8 |
Level 1 (almost all) |
IE 9~9.9 |
1-, 2-, 3-stage |
Opera 1~6 |
- |
Opera 7~8.x |
Level 1 (almost all), Level 2 (partial) |
Opera 9~9.9 |
Class 1, Level 2 (almost all), Level 3 (partial) |
Opera |
1-, 2-, 3-stage (partial) |
Safari 1.0.x |
Level 1 |
Safari |
Level 1, Level 2 (partial) |
Chrome 1+ |
Level 1, Level 2 (partial) |
Firefox 1+ |
Class 1, Level 2 (almost all), Level 3 (partial) |
Browser Object Model BOM
The BOM only handles browser windows and frames, but it is customary to count all browser-specific JavaScript extensions as part of the BOM. Developers use the BOM to control parts of the page that the browser displays.
The BOM does not have the relevant standards as part of the JavaScript implementation, so each browser will have its own implementation, which is not only the difference between the BOM, but also the place where it often leads to problems. The problem was solved until HTML5 wrote many BOM functions into the formal specification.
JavaScript version
Browser |
JavaScript version |
Netscape Navigator 2 |
1.0 |
Netscape Navigator 3 |
1.1 |
Netscape Navigator 4 |
1.2 |
Netscape Navigator 4.06- |
1.3 |
Netscape 6+ (Mozilla 0.6.0+) |
1.5 |
Firefox 1 |
1.5 |
Firefox 1.5 |
1.6 |
Firefox 2 |
1.7 |
Firefox 3 |
1.8 |
Firefox 3.5 |
1.8.1 |
Firefox 3.6 |
1.8.2 |
Only Netscape/mozilla browsers follow this numbering pattern, and most browsers support JavaScript in the ECMAScript compatibility and DOM support scenarios.
Introduction to JavaScript