DOMContentLoaded EventLiterally, it fires after the DOM is loaded. Very similar to the window.onload event, but with some differences:
The next question is when the DOM is loaded. This starts with browser rendering. The process of browser displaying a web page can be described as follows: 1. Request an HTML document, and then request more img, css and other resource files based on the document; 2. Parse the document to get two things, DOM tree and CSS tree; 3. Generate render tree based on the above two trees; 4. Perform layout according to the render tree and draw related elements in it. Taking webkit as an example, its rendering process is as follows: DOMContentLoaded event triggers when: After DOM and before RENDERtree. JavaScript loading and execution will delay the triggering of the DOMContentLoaded event. JavaScript has to wait for CSS rendering to complete before loading and executing, because the browser cannot determine whether JavaScript needs DOM element information. To ensure that JavaScript has the latest information, the CSS is loaded and rendered first. Reference Documents: http://www.softwhy.com/article-9783-1.html https://www.cnblogs.com/CandyManPing/p/6635008.html https://www.cnblogs.com/caizhenbo/p/6679478.html This is the end of this article about the detailed case of JavaScript DOMContentLoaded event. For more relevant JavaScript DOMContentLoaded event content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Two methods to implement MySQL group counting and range aggregation
>>: How to expand Linux swap memory
Real-time replication is the most important way t...
1. Create a repository in the specified directory...
(1) Each HTML tag has an attribute style, which c...
Querying the database SELECT * FROM `student` Que...
Method 1: Use the target event attribute of the E...
1.1 Introduction By enabling the slow query log, ...
In CSS, element tags are divided into two categor...
This article mainly introduces the relevant conte...
In the previous article https://www.jb51.net/arti...
Tab selection cards are used very frequently on r...
The application of containers is becoming more an...
Configuration Instructions Linux system: CentOS-7...
In web development, since the checkbox is small an...
We all know the drag-and-drop feature of HTML5, w...
Background - Online Alert An online server issued...