I don't know what it's like to be a smart reader when I look at this topic. This article will talk about the relationship between JavaScript and Dom? Or do you want to speak JavaScript dom?
Here I'll start by stating that the main thrust of the article is two: what is DOM? What is the relationship between it and JavaScript?
What is DOM?
Official Explanation: The document Object Model is a programming interface for HTML and XML documents. It provides a structured representation method to the document . Ability to change the content and presentation of documents.
Read the official explanation that. Still don't feel like that, so please follow me to continue, after reading this article I believe you have a common understanding of the above official explanation .
Different types of page documents have different DOM, this article will start with the HTML DOM. D in the DOM can be understood as a web-loaded document, and when a Web page is created and loaded into the browser, the DOM is quietly behind the scenes. It will create a document object based on the Web document you are writing.
O refers to an object. The Document object. The DOM encapsulates each element in an HTML page as an object.
M is a model, but I prefer to say structure, and this model embodies the structural relationships between the elements of HTML.
The encapsulated object forms a single reproductive family Atlas tree in the form of nodes, and each page element can be positioned exactly.
two HTML and DOM
The following diagram explains the relationship between the two of them.
we are not hard to see. The relationship between the two of them. The labels in the HTML page and the nodes in the DOM map are one by one corresponding. A section point in the Dom is a mapping of the labels in a Web page.
We can operate on the elements by manipulating the nodes. All HTML elements can be visited by the outside world through the objects, methods, and properties provided by the DOM . Together with the text and attributes they contain, they are able to modify and delete the content. New elements can also be created at the same time . This unlocks the coupling between the HTML page content and the dynamic implementation. The same time helps protect the structure of the original HTML page.
three JavaScript and Dom
with JavaScript, you can refactor an entire HTML document to join, delete, change, or rearrange items on a page. To change the page, JavaScript
This entry. Contains
dom is a set of norms, standards. Dom is not part of JavaScript. It provides object methods for JavaScript. It is the channel or interface that the Web page uses to make
Dom has a "status quo Bosom". The DOM unlocks the coupling between Web content and dynamic implementations.
Summary:
dom is a set of standard specifications, which is also an interface that Web documents provide externally. DOM enables the separation of page content and implementation, giving the Web a higher level of flexibility. JavaScript enables the dynamic functionality of HTML pages. And Dom is the bridge that connects them.
JavaScript---HTML DOM