html dom is the w3c standard (short for html document object model,document object model for html).
html dom defines a standard set of objects for html,And standard methods for accessing and processing html documents.
With dom, you can access all the html elements, along with the text and attributes they contain.You can modify and delete the content,You can also create new elements.
1. The browser fetches and loads your page,Parse its contents from top to bottom.
The browser will also build an internal model (dom) of the html page.
How do you make them interact?
The answer is to use a document object model (dom).
The beauty of dom is that it provides a consistent way across all browsers,Access the structure and content of html through code.
1. When the browser loads a page,The browser parses the html and creates an internal model of the document.It contains all the elements of the html tag.
A document is an object that reflects html. The state of the dom is changed by calling the document method, which is to change the html page.
Material:well-formed html5 page, web browser
1, create a document node on the top
2, take the topmost element of the html page,Here is theelement, add it to the dom as a child of the document
3. For each element nested in the current element,Add this element as a child of the current element to the dom
4. For the newly added element,Perform the third step,repeating work,Until all elements are processed
The html page is as follows:
<! Doctype html> <html lang="helloworld"> <head> <title>dom</title> <meta cherset="utf-"> <script src="dom.js"></script> </head> <body> <h>my dom</h> <div> <h>hello</h> <p> today, i am making a dom !!! </p> </div> </body> </html>
The resulting dom is shown below
- JSP parsing xml instance based on dom
- Easily create a nodejs server (5): event handler
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- dart - flutter: the instance member'stars' can't be accessed in an initializer error