DOM, DOM MANIPULATION

milmil·2023년 4월 12일
0

WHAT IS THE DOM❓

DOM means Document Object Model

Structed representation of HTML documents.
Allows JavaScript to access HTML elements and styles to manipulate them.
manipulate means - changing text, HTML attributes, and even CSS styles.

THE DOM TREE🌳 STRUCTURE

<html>
	<head>
    	<title>A Simple Page</title>
    </head>
    <body>
    	<section>
        	<p>A paragraph with a <a>link</a></p>
            <p>A second paragraph</p>
        </section>
    </body>
</html>

Dom always starts with the DOCUMENT element from the very top.

📃DOCUMENT

Special object that is the entry point to the DOM.
ex) document.querySelector()

HTML

usually has two child elements, head and body

As we keep going deeper into the nested HTML structure, we keep adding more and more children to the DOM tree.

has title element

body

has section element

section

has p element

p

has a element

DOM !== JAVASCRIPT🤦‍

MANY PEOPLE THINK 🤔

DOM Methods and Properties for DOM Manipulation are part of JS.
But it's not the case.

Remember that 😊

JavaScript is actually just a dialect of the ECMAScript specification,and all this DOM related stuff is simply not in there.

Then how does this all work?

The DOM and DOM methods are actually part of something called the web APIs.

Web APIs

The web APIs (Application Programming Interface) are like libraries that browsers implement and that we can access from our JavaScript code.

Besides the DOM, there are a ton more web APIs, such as timers, the fetch API, and many more.

source from : The Complete JavaScript Course 2023 by jonas in Udemy

profile
You can't change yourself if you don't know about yourself.

0개의 댓글