Difference between HTML and DOM

前端 未结 5 1339
暖寄归人
暖寄归人 2020-12-04 16:54

What is the difference between DOM and HTML?

5条回答
  •  温柔的废话
    2020-12-04 17:29

    The HTML of a page is a string, and the DOM of the page is what happens when you take that string and construct an object in the object-oriented programming sense of the term "object". Creating that object is how JavaScript is able to interact with the page:

    https://en.wikipedia.org/wiki/Document_Object_Model#JavaScript

    When a web page is loaded, the browser creates a Document Object Model of the page, which is an object oriented representation of an HTML document, that acts as an interface between JavaScript and the document itself and allows the creation of dynamic web pages.

提交回复
热议问题