Home>Article>Web Front-end> What is dom in html5
The dom in html5 is the abbreviation of "Document Object Model", which means document object model. It is an API for HTML and XML documents; dom defines a standard method for accessing and operating HTML documents. Through dom Parts of the page can be dynamically added, removed, and modified.
The operating environment of this article: Windows 10 system, html5 version, Dell G3 computer.
DOM is the Document Object Model (Document Object Model), which defines the standard method of accessing and operating HTML documents.
Through DOM, developers can dynamically add, remove and modify certain parts of the page.
DOM (Document Object Model) is an API for HTML and XML documents. Documents can be changed through DOM.
DOM expresses HTML documents as a tree structure, as follows:
This statement is very official, but everyone still doesn’t understand it.
For example: We have a piece of HTML, so how to access the first node of the second layer, and how to move the last node to the first node?
DOM defines the standard for how to do similar operations. For example, use getElementById to access nodes and insertBefore to insert nodes.
When the browser loads HTML, it will generate the corresponding DOM tree.
In short, DOM can be understood as an implementation standard for accessing or operating various HTML tags.
Through DOM, developers can dynamically add, remove and modify certain parts of the page.
Since the HTML document is parsed by the browser, it becomes a DOM tree. To change the structure of HTML, you need to operate the DOM through JavaScript.
Always remember that DOM is a tree structure. Operating a DOM node actually consists of the following operations:
Update: Updating the content of the DOM node is equivalent to updating the content of the HTML represented by the DOM node;
Traverse: Traverse the child nodes under the DOM node for further operations;
Add: Add a new child node under the DOM node, equivalent Yu Dynamically adds an HTML node;
Delete: Deleting the node from HTML is equivalent to deleting the content of the DOM node and all the child nodes it contains.
Recommended tutorial: "html video tutorial"
The above is the detailed content of What is dom in html5. For more information, please follow other related articles on the PHP Chinese website!