The main function of a browser is to present the web resource you choose, by requesting it from the server and displaying it in the browser window.
The resource is usually an HTML document, but may also be a PDF, image, or some other type of content.
The rendering engine will start getting the contents of the requested document from the networking layer.
The rendering engine will start getting the contents of the requested document from the networking layer.
Only Visual Elements Are In The Render Tree
Not Part of Render Tree
switch (style.get().display()) {
case NONE:
style.dropRef();
return nullptr;
case INLINE:
return createRenderer<RenderInline>(element,
WTF::move(style));
...
}
The render tree contains rectangles with visual attributes like color and dimensions. The rectangles are in the right order to be displayed on the screen.
The render tree contains rectangles with visual attributes like color and dimensions. The rectangles are in the right order to be displayed on the screen.
WebKit main flow
Unlike HTML, CSS is a context free grammar
ruleset
: selector [ ',' S* selector ]*
'{' S* declaration [ ';' S* declaration ]* '}' S*
;
selector
: simple_selector [ combinator selector | S+ [ combinator? selector ]? ]?
;
simple_selector
: element_name [ HASH | class | attrib | pseudo ]*
| [ HASH | class | attrib | pseudo ]+
;
class
: '.' IDENT
;
element_name
: IDENT | '*'
;
attrib
: '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S*
[ IDENT | STRING ] S* ] ']'
;
pseudo
: ':' [ IDENT | FUNCTION S* [IDENT S*] ')' ]
;
The Browser Object Model (BOM) is a browser-specific convention referring to all the objects exposed by the web browser.
Basically window javascript object in web browsers.
There are two methods for scheduling work after a certain time.
AJAX IS NOT...
Ajax is a set of Web development techniques using many Web technologies on the client side to create asynchronous Web applications.
Technologies
Making Requests with JavaScript
XMLHTTP Request
const XHR = new XMLHttpRequest();
XHR.onreadystatechange = function() {
if (XHR.readyState == 4 && XHR.status == 200) {
console.log(XHR.responseText);
}
};
XHR.open("GET", "https://api.github.com/zen");
XHR.send();
The concept behind the XMLHttpRequest object was originally created by Microsoft.
fetch
fetch('/users.html')
.then(function(response) {
return response.text()
}).then(function(body) {
document.body.innerHTML = body
})
The fetch() function is a Promise-based mechanism for programmatically making web requests in the browser.
fetch(url, {
method: 'POST',
body: JSON.stringify({
name: 'blue',
login: 'bluecat',
})
}).then(function (data) {
//do something
}).catch(function (error) {
//handle error
});
API's don't respond with HTML. API's respond with pure data, not structure.
More efficient formats such as XML and JSON are used.
XML
<pin>
<title>Adorable Maine Coon</title>
<author>Cindy S</author>
<num-saves>1800</num-saves>
</pin>
XML is syntacticly similar to HTML, but it does not describe presentation like HTML does
JavaScript Object Notation
'pin': {
'title': 'Adorable Maine Coon',
'author': 'Cindy S',
'num-saves': 1800
}
JSON looks (almost) exactly like JavaScript objects
JSON is a syntax for serializing objects, arrays, numbers, strings, booleans, and null.