You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ The browser tries to figure out the IP address for the entered domain. The DNS l
80
80
Here is a diagram of what a recursive DNS search looks like:
81
81
82
82
<palign="center">
83
-
<imgsrc="http://igoro.com/wordpress/wp-content/uploads/2010/02/500pxAn_example_of_theoretical_DNS_recursion_svg.png"alt="Recursive DNS search"/>
83
+
<imgsrc="img/Example_of_an_iterative_DNS_resolver.svg"alt="Recursive DNS search"/>
84
84
</p>
85
85
86
86
One worrying thing about DNS is that the entire domain like wikipedia.org or facebook.com seems to map to a single IP address. Fortunately, there are ways of mitigating the bottleneck:
@@ -234,7 +234,7 @@ Once the server supplies the resources (HTML, CSS, JS, images, etc.) to the brow
234
234
7.**Data Storage:** This is a persistence layer. The browser may need to save data locally, such as cookies. Browsers also support storage mechanisms such as [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB) and [FileSystem](https://developer.chrome.com/apps/fileSystem).
Let’s start, with the simplest possible case: a plain HTML page with some text and a single image. What does the browser need to do to process this simple page?
@@ -248,15 +248,15 @@ Let’s start, with the simplest possible case: a plain HTML page with some text
248
248
4.**DOM construction:** Finally, because the HTML markup defines relationships between different tags (some tags are contained within tags) the created objects are linked in a tree data structure that also captures the parent-child relationships defined in the original markup: HTML object is a parent of the body object, the body is a parent of the paragraph object, and so on.
249
249
250
250
<palign="center">
251
-
<imgsrc="https://developers.google.com/web/fundamentals/performance/critical-rendering-path/images/full-process.png"alt="DOM Construction Process"/>
251
+
<imgsrc="img/full-process.png"alt="DOM Construction Process"/>
252
252
</p>
253
253
254
254
The final output of this entire process is the Document Object Model, or the “DOM” of our simple page, which the browser uses for all further processing of the page.
255
255
256
256
Every time the browser has to process HTML markup it has to step through all of the steps above: convert bytes to characters, identify tokens, convert tokens to nodes, and build the DOM tree. This entire process can take some time, especially if we have a large amount of HTML to process.
257
257
258
258
<palign="center">
259
-
<imgsrc="https://developers.google.com/web/fundamentals/performance/critical-rendering-path/images/dom-timeline.png"alt="Tracing DOM construction in DevTools"/>
259
+
<imgsrc="img/dom-timeline.png"alt="Tracing DOM construction in DevTools"/>
260
260
</p>
261
261
262
262
If you open up Chrome DevTools and record a timeline while the page is loaded, you can see the actual time taken to perform this step — in the example above, it took us ~5ms to convert a chunk of HTML bytes into a DOM tree. Of course, if the page was larger, as most pages are, this process might take significantly longer. You will see in our future sections on creating smooth animations that this can easily become your bottleneck if the browser has to process large amounts of HTML.
@@ -290,7 +290,7 @@ The rendering engine will start getting the contents of the requested document f
290
290
After that the basic flow of the rendering engine is:
The rendering engine will start parsing the HTML document and convert elements to [DOM](http://domenlightenment.com/) nodes in a tree called the **"content tree"**.
@@ -307,7 +307,7 @@ It's important to understand that this is a gradual process. For better user exp
307
307
Given below is Webkit's flow:
308
308
309
309
<palign="center">
310
-
<imgsrc="http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/webkitflow.png"alt="Webkit main flow"/>
310
+
<imgsrc="img/webkitflow.png"alt="Webkit main flow"/>
311
311
</p>
312
312
313
313
## Parsing Basics
@@ -325,7 +325,7 @@ Parsing can be separated into two sub processes: lexical analysis and syntax ana
325
325
Parsers usually divide the work between two components: the lexer (sometimes called tokenizer) that is responsible for breaking the input into valid tokens, and the parser that is responsible for constructing the parse tree by analyzing the document structure according to the language syntax rules. The lexer knows how to strip irrelevant characters like white spaces and line breaks.
326
326
327
327
<palign="center">
328
-
<imgsrc="http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/image011.png"alt="Source document to parse tree"/>
328
+
<imgsrc="img/image011.png"alt="Source document to parse tree"/>
329
329
</p>
330
330
331
331
The parsing process is iterative. The parser will usually ask the lexer for a new token and try to match the token with one of the syntax rules. If a rule is matched, a node corresponding to the token will be added to the parse tree and the parser will ask for another token.
@@ -339,7 +339,7 @@ HTML parsing algorithm consists of two stages: tokenization and tree constructio
339
339
**Tokenization** is the lexical analysis, parsing the input into tokens. Among HTML tokens are start tags, end tags, attribute names and attribute values. The tokenizer recognizes the token, gives it to the tree constructor, and consumes the next character for recognizing the next token, and so on until the end of the input.
@@ -391,7 +391,7 @@ There are DOM elements which correspond to several visual objects. These are usu
391
391
Some render objects correspond to a DOM node but not in the same place in the tree. Floats and absolutely positioned elements are out of flow, placed in a different part of the tree, and mapped to the real frame. A placeholder frame is where they should have been.
392
392
393
393
<palign="center">
394
-
<imgsrc="http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/image025.png"alt="The render tree and the corresponding DOM tree"/>
394
+
<imgsrc="img/image025.png"alt="The render tree and the corresponding DOM tree"/>
395
395
</p>
396
396
397
397
In WebKit the process of resolving the style and creating a renderer is called "attachment". Every DOM node has an "attach" method. Attachment is synchronous, node insertion to the DOM tree calls the new node "attach" method.
0 commit comments