1. DOM and JS Engine #

Created Saturday 11 July 2020

The DOM (Document Object Model) #

We assumed, until now that HTML is just rendered by the browser. Now, before rendering, there needs to be some concrete representation of the HTML in memory. This representation is called the Document Object Model(DOM). It is created by the browser as soon as the HTML is received.

The HTML DOM is a standard for how to get, change, add, or delete HTML elements.


document.write('Hello'); // document the write method

Think of the document object as the skeleton of the screen that we see(with our eyes). Note: DOM and document are used interchangeably. DOM vs CSS vs reality

The JS Engine #

window and document objects #

Note: window cannot be written to for UI stuff usually, because it is just the action part.

window.write(  '<p>abcd</p>'); // error
document.write('<p>abcd</p>'); // Okay