当前位置:网站首页>Understanding JS foundation and browser engine
Understanding JS foundation and browser engine
2022-07-26 16:32:00 【JS human column force】
js
know JavaScript
Wikipedia is right JavaScript The definition of :
JavaScript( Commonly abbreviated as JS) It's a kind of advanced , Interpretive programming languages
JavaScript It's a prototype 、 The language of first-class functions , It is a multi-paradigm language , It supports object-oriented programming , Directive function , And functional programming
It's a client language , In the browser . Is a scripting language , What can be interpreted and executed directly is called script code . image dos Orders and SQL It's also .
JavaScript The origin of
1994 year , Netscape (Netscape) Released Navigator browser 0.9 edition
This is the first mature web browser in history , Hit
however , This version of browser can only be used to browse , No ability to interact with visitors
Netscape is in urgent need of a web scripting language , Enable the browser to interact with the web
Netscape wanted to choose a language to embed in the browser :
Use the existing language , such as Perl、Python、Tcl、Scheme wait , Allow them to embed directly into the web ;
1995 In, Netscape recruited programmers Brendan Eich, I hope to Scheme The possibility of language as web script language
At this moment , Another big thing happened :1995 year Sun The company will Oak The language was renamed Java, Officially launch ;
Java After its launch, it immediately caused a sensation in the market ,Java There was a slogan :‘write once run anywhere’;
Netscape is excited , Decision and Sun The company formed an alliance , I hope to Java Embedded in the web page to run ;
Brendan Eich I am very keen on Scheme, But the management was a little inclined at that time Java, I hope it can be simplified Java To meet the needs of Web script
however Brendan Eich Not interested in this , another use 10 Days time has been designed JavaScript;
At first the name of this language was Mocha( mocha );
stay Navigator2.0 beta The version was renamed LiveScript
stay Navigator2.0 beta 3 The version was officially renamed JavaScript, At that time, it was to match the language Java This hot word ;
Of course 10 The language designed by Tian is enough to explain Brendan Eich It's genius , But the language was more like a multilingual hodgepodge ;
reference C Language Basic syntax ;
reference Java Language Data types and memory management ;
reference Scheme Language , Promoted the function to " First class citizens "(first class) The status of ;
reference Self Language , Use prototype based (prototype) The inheritance mechanism of .
Microsoft at 1995 First launched in Internet Explorer, This led to a conflict with Netscape Browser Wars .
Microsoft Netscape Navigator The interpreter is reverse engineered , Created JScript, With the market leader
This time is bad news for developers , Because you need different adaptations for different browsers
1996 year 11 month , Netscape is officially reporting to ECMA( European Association of computer manufacturers ) Submit language standards
1997 year 6 month ,ECMA With JavaScript Language is the basis for making ECMAScript Standard specification ECMA-262;
ECMA-262 It is a standard , Defined ECMAScript
JavaScript Become ECMAScript One of the most famous realizations ;
besides ,ActionScript and JScript All of them are ECMAScript Standard implementation language ;
So ECMAScript It's a norm , and Javascript Is an implementation of this specification
JavaScript The composition of
ECMAScript yes JavaScript Standards for , Describes the syntax and basic objects of the language
DOM ( Document object model ) When the web page is loaded , The browser will create the document object model of the page (DocumentObjectModel).
BOM Browser object model (Browser Object Model, BOM) Widely used in Web Under development , It is mainly used for the management of client browser .
JS engine
JS The engine is used to run JavaScript Code
Different browsers have different cores
Gecko: Early by Netscape and Mozilla Firefox Browsers use
Trident: Microsoft development , By IE4-IE11 Browsers use , however Edge Browsers have turned to Blik
Weblit: Apple is based on KHTML Development 、 Open source , be used for Safari,Google Chrome It was used before ;
Blik: yes Webkit A branch of ,Goole Development , Currently used in Goole Chrome 、Edge、Opera etc.
in fact , We often say that the browser kernel refers to the typesetting engine of the browser :
Layout engine (layout engine) , Also known as browser engine (browser engine)、 Page rendering engine (rendering engine) Or sample engine
common JS engine :
SpiderMonkey: The first paragraph JavaScript engine , from Brendan Eich Development ( That is to say JavaScript author )
Chakra: Microsoft development , be used for IT browser
JavaScriptCore:Webkit Medium JavaScript engine ,Apple Companies to develop ;
V8:Google The power of development JavaScript engine , It also helps Chrome Stand out from many browsers
Browser kernel and JS Engine relationship
With Webkit For example ,WebKit In fact, it consists of two parts :
webCore: be responsible for HTML analysis 、 Layout 、 Rendering and so on ;
JavaScriptCore: analysis 、 perform JavaScript Code
JavaScript The way of writing
- HTML Within the code line ( Not recommended )

When we click a The label will pop up 
- script In the label
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ju7poYG2-1658590542397)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220723230802473.png)]](/img/66/9ad3070bea784d01d5e313186a9387.png)
- External script file
Need to pass through script Elemental src attribute To introduce JavaScript file
< noscript> Elements
When the browser doesn't support JavaScript Code runs


JavaScript Notes for writing
Pay attention to one :script Elements cannot be written as single labels
External chained reference js When you file ,script The label cannot be written as JavaScript Code , also script Labels cannot be written as single labels
Attention two : Omit type attribute
In the previous code ,< script > Will be used in the label type=‘text/JavaScript’;
You can not write this now type Element , because JavaScript It's all modern browsers and HTML5 The default scripting language in
Note three : Loading order
As HTML Part of the document content ,JavaScript By default follow HTML Loading order of documents , That is, the top-down loading sequence ;
It is recommended that JavaScript The code and writing location are body The last line of the child element ;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- Put it in body The last line -->
<script></script>
</body>
</html>
Notice four :Javascript The code is strictly case sensitive
HTML Elements and CSS Properties are case insensitive , But in JavaScript Strictly case sensitive in
边栏推荐
- Linux Installation mysql8.0.29 detailed tutorial
- MVC和ECS两种设计架构的初浅理解
- Pat class a 1047 student list for course
- 国元期货网上开户安全吗?开户办理流程是怎样的?
- vlang捣鼓之路
- Clojure operation principle bytecode generation
- 阿里云DMS MySQL云数据库建表报错,求解!!
- Modify the password of the root user of MySQL database
- 初识OpenGL (2)编译着色器
- Finally, someone explained the red blue confrontation clearly
猜你喜欢

Vscode batch delete

Sql语句——单行注释与多行注释

2022 latest Tibet Construction scaffolder (construction special operation) simulation exam questions and answers

测试用例千万不能随便,记录由一个测试用例异常引起的思考
![[RCTF2015]EasySQL](/img/68/328ee5cffc8b267b6b0f284eb8db2c.png)
[RCTF2015]EasySQL

Comprehensively design an oppe homepage -- the design of the top and head
![[BJDCTF2020]Easy MD5](/img/6a/61a4b5624c33f1f334bea344cfa2c8.png)
[BJDCTF2020]Easy MD5

Linux安装mysql8.0.29详细教程

What is the complexity often said during the interview?

The difference between anonymous methods and lambda expressions
随机推荐
Selection of industrial serial port to WiFi port to Ethernet module of Internet of things
Bugku login2
Re7:读论文 FLA/MLAC Learning to Predict Charges for Criminal Cases with Legal Basis
初识OpenGL (3)片段着色器(Fragment Shader)
[physical simulation] the principle and practice of the simplest shape matching
Why is digital transformation so difficult?!
PAT甲级 1044 Shopping in Mars
Clojure Web Development -- ring user guide
基于NoCode构建简历编辑器
movable-view 组件(可上下左右拖动 )
JS API summary of Array Operations
阿里云DMS MySQL云数据库建表报错,求解!!
srec_ Use of common cat parameters
Interface test for quick start of JMeter
NUC 11构建 ESXi 7.0.3f安装网卡驱动-V2(2022年7月升级版)
[BJDCTF2020]Easy MD5
C#读取本地文件夹中所有文件文本内容的方法
综合设计一个OPPE主页--导航栏的设计
What is the complexity often said during the interview?
结构体和类使用的区别