Like CSS, JavaScript is not exactly the same in every browser, and the compatibility issues that come with it often plague us, so that the "ability to deal with the compatibility of popular browsers" has become one of the criteria for verifying a programmer's eligibility. Understanding JavaScript's past life may help us to better understand and deal with the compatibility issues that browsers bring. At the same time, beginners standing in higher places to re-examine JavaScript, may be able to uncover its mystery, once it lost its mystique and become approachable, learning will be more relaxed.
A few days ago, I read a book, "JavaScript core concepts and practices," Chu Juntao. More than half of the content in the book lists some of the core knowledge points of JavaScript, and the remainder of the content describes the JavaScript interpretation engine, including but not limited to web clients. I slowly had an idea that I wanted to re-learn JavaScript's past life, so I had this article.
The birth of JavaScript
As we all know, Brendan Eich spent 10 days in May 1995 creating the JavaScript language, the first Netscape Navigator2 browser for Netscape.
JavaScript was initially named "LiveScript", in order to complete livescript development before the release date, Netscape United Sun established a development alliance, on the eve of Navigator2 release, Netscape in order to catch the media stir Java's hitch, temporarily change livescript to JavaScript. JavaScript1.1 with the release of Navigator3, user focus on a record high, Netscape positioning themselves as the market leader.
In order to compete with Netscape, Microsoft added JavaScript implementations in IE3, in order to avoid licensing disputes named JScript.
Premature standardization
In the early days of the browser war, three different JavaScript versions existed: Cenvi in JScript and Scriptease in Javascript,internet Explorer in navigator. The industry suffers from the incompatible suffering caused by vicious competition and strongly calls for a language standard.
Netscape Internet Software is the source of all revenue, with annual revenue of 300 million. and Microsoft's annual revenue of 8 billion, Internet software is completely free, do not need to profit. Netscape has long been aware of the form of crisis, in order to lay its own position, she based on their JavaScript1.1, to the ECMA submitted a standardized application. Finally, the 39th Committee (TC39), composed of company programmers from Netscape, Microsoft, Sun, and other interested scripting languages, completed the ecma-262--definition of a name ECMAScript (pronounced "ek-ma-script") scripting language Standard.
So far, four ECMA-262 versions have been published, and the Code "Harmony" version is in operation. The release with the 1999 ECMAScript Third Edition (abbreviated as ES3) is currently widely supported. the C language was born in 1972, and the first standard was enacted in 1989, which lasted nearly 20 years. JavaScript has only been used for less than two years from invention to standardization. The standardization of "premature" has its advantages, and naturally it has its drawbacks.
ECMAScript derived languages
After JavaScript has been standardized, the fact that we're talking about JavaScript now has a much broader meaning. In the browser, a complete JavaScript should have JavaScript Core (ECMAScript), Dom,bom composition. JavaScript is just a derived language of ECMAScript. See the table below (excerpted from Wikipedia):
Application |
Dialect |
The corresponding ECMAScript version |
FireFox |
JavaScript 1.8.1 |
ECMAScript-262 Fifth Edition |
Chrom |
Javascript |
ECMAScript-262 Fifth Edition |
Internet Explorer |
JScript 9.0 |
ECMAScript-262 Fifth Edition |
Opera |
ECMAScript |
ECMAScript-262 Fifth Edition |
Safari |
Javascript |
ECMAScript-262 Third Edition |
Microsoft. NET Framework |
Jscript. NET8.0 |
ECMAScript-262 Third Edition |
Adobe Flash and adobe Flex |
ActionScript 3 |
ECMAScript-262 Third Edition |
JS Interpretation engine
Generally speaking, JavaScript is an interpreted language, especially in the browser. While this is not a rule, in Rhino , scripts can be compiled into Java bytecode. Google's V8 engine compiles JavaScript code directly into local code without explanation.
JavaScript can be implemented on any platform, including the server side. Different platforms implement different ECMAScript dialects, and interpretation engines vary. The first JavaScript interpretation engine in history was named SpiderMonkey, Brendan Eich was written in C when Netscape.
The JavaScript engine for the main web browser is as follows (excerpt from Wikipedia):
Mozilla:
SpiderMonkey, the first JavaScript engine, was written by Brendan Eich in Netscape Communications for Mozilla Firefox.
Tracemonkey, based on the real-time compilation of the engine, some of the code is taken from the Tamarin engine for Mozilla Firefox 3.5~3.6 version.
Jaegermonkey, German Jäger originally intended for hunters, combined with tracking and combination of code technology greatly improve performance, part of the technology by Chisel V8, JavaScriptCore, WebKit, for Mozilla Firefox 4.0~11 version.
Ionmonkey, you can optimize the results of JavaScript compilation for Mozilla Firefox 18.0 or later.
Odinmonkey, asm.js can be optimized for Mozilla Firefox 22.0 or later.
Rhino, managed by the Mozilla Foundation, is open source and written entirely in Java.
Google:
V8, written in C + +, open source, developed by Google Denmark, is part of Google Chrome.
Microsoft:
Chakra (JScript engine), the Chinese translation is the Chakra for the 32-bit version of Internet Explorer 9 and Internet Explorer 10.
Opera:
Linear A, for opera 4.0~6.1 version.
Linear B, for opera 7.0~9.2 version.
Futhark, for opera 9.5~10.2 version.
Carakan, for opera 10.50~14 version.
On the server side, for example, node. JS is a framework based on the Google V8 JavaScript engine.
Summarize
Javasctipt engine has a wide variety, coincidentally, in the Web browser, the HTML typesetting engine (also known as the browser kernel ) is also the same contention, the splendor.
The main four typesetting engines are:Trident(applied to IE),Gecko(for FF),Blink(for Chrome and Opera); WebKit (applies to Safari and earlier versions of Chrome).
In addition, there are some typesetting engines that are being developed.
Servo is an experimental web browser typesetting engine, developed by Mozilla, and ported to Android and ARM processors by Samsung Group .
The edgehtml engine is a branch of Trident that will be used for Microsoft Edge Browser (development code named Project Spartan , often abbreviated as Spartan). The browser will be the default browser in the Windows 10 and Windows 10 Mobile Editions instead of IE.
In front-end development, CSS compatibility questions are often caused by the browser's typesetting engine, while JavaScript compatibility issues are created by the browser's JavaScript interpretation engine. JavaScript compatibility problems are more in the DOM and BOM, the different typesetting engine and JS interpretation engine execution efficiency is completely inconsistent, even to 10 times times more. What's more, the JavaScript interpretation engine itself also has bugs, which requires programmers to pay attention to and avoid.
Understand JavaScript's past life, only to find that the original JavaScript is learning what kind of a language--20 years ago no one could have expected it to become so great. Once again faced with compatibility issues, I hope we can be targeted, do not complain.
JavaScript: Learn it, you just need a moment to master it, you need years.
Finish
JavaScript's past Life