Skip to content

Commit b463e0a

Browse files
committed
DOM Notes
1 parent 615f63a commit b463e0a

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Notes/DOM.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# DOM (Document Object Model)
2+
3+
The Document Object Model (DOM) is the data representation of the objects that comprise the structure and content of a document on the web.
4+
5+
It represents the page so that programs can change the document structure, style, and content.
6+
7+
The DOM represents the document as nodes and objects; that way, programming languages can interact with the page.
8+
9+
# DOM Tree
10+
11+
The DOM tree (Document Object Model tree) is a hierarchical representation of the structure of a web document, such as an HTML or XML page. It reflects how the browser interprets and organizes the page's content into a tree-like data structure.
12+
13+
## Key Concepts:
14+
- DOM stands for Document Object Model.
15+
- The DOM turns HTML elements into nodes arranged in a tree structure.
16+
- Each node represents a part of the document (like an element, text, or comment).
17+
18+
## Types of Nodes:
19+
- Element nodes: HTML elements like <body>, <h1>, <p>.
20+
- Text nodes: The text inside those elements.
21+
- Attribute nodes: Attributes like class, id, etc. (usually accessed via element nodes).
22+
- Comment nodes: HTML comments like <!-- comment -->.
23+
24+
## Why It Matters:
25+
The DOM allows JavaScript to interact with and modify the page dynamically.
26+
For example: document.getElementById("myId") gets a node, and you can change its content or style.
27+
28+
## DOM Tree Example
29+
30+
![DOM Tree](images/DOMTree.png)
31+
32+
33+
### More:
34+
[DOM - MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction)

Notes/DOMTree.md

Whitespace-only changes.

Notes/images/DOMTree.png

249 KB
Loading

0 commit comments

Comments
 (0)