function foo() {
console.log('wow');
}
function bar() {
foo();
}
function baz() {
bar();
}
baz();
function foo() {
console.log('wow');
}
function bar() {
foo();
}
function baz() {
bar();
}
baz();
function foo() {
return foo();
}
foo();
var foo = $ajaxSynchGET('/resource1');
var bar = $ajaxSynchGET('/resource2');
var baz = $ajaxSynchGET('/resource3');
console.log(foo);
console.log(bar);
console.log(baz);
console.log('I');
setTimeout(function() {
console.log('talk');
}, 5000);
console.log('alot');
console.log('I');
setTimeout(function() {
console.log('talk');
}, 5000);
console.log('alot');
console.log('I');
setTimeout(function() {
console.log('talk');
}, 5000);
console.log('alot');
Parse HTML +
Parse CSS
Paint
Layout
Render Tree
<body><p class=hopa>Look mom, no quotes</p>
<div><span>How is this happening
<html>
<head></head>
<body>
<p class="hopa">
Look mom, no quotes
</p>
<div>
<span>
How is this happening
</span>
</div>
</body>
</html>
Script Execution
DOM
Tree Construction
Tokenizer
html
head
body
p.hopa
#text
div
span
#text
HTMLHtmlElement
HTMLHeadElement
HTMLBodyElement
HTMLParagraphElement
Text
HTMLDivElement
HTMLSpanElement
Text
<script src="smth.js" />
//......
<img src="nyan_cat.jpg">
<link href="cats.css" />
p.div {
width: 28rem;
}
.container {
color: black;
}
CSSStyleSheet
CSSRule
CSSRule
Selectors
Declaration
Selectors
Declaration
p
div
width
28rem
.container
color
black
DOM Node
DOM Node
DOM Node
DOM Node
DOM Node
DOM Node
DOM Node
display: none
float: right
font-size: 16px
RenderObject
float: right
RenderObject
RenderObject
RenderObject
RenderObject
RenderObject
font-size: 16px
RenderLayer
RenderLayer
RenderLayer
RenderLayer