HTML5 actual combat and analysis of HTMLDocument changes

黄舟
Release: 2017-05-25 15:21:52
Original
1954 people have browsed it

I have previously introduced you to some of the new additions to HTML5, and I believe you all have some understanding of them. Today I will introduce to you the newly added content about HTMLDocumentin HTML5. So what are the newly added contents about HTMLDocument in HTML5? The newly added contents about HTMLDocument in HTML5 include readyState attribute, compatibility mode judgment and head attribute. Let me introduce these newly added little things to you one by one.

1. readyState attribute

As early as the IE4 era, the document object introduced the readyState attribute, but it has never been included in the standard. Now, in HTML5 As time goes by, it has been incorporated into the norm. The readyState attribute has two possible values:

 (1) loading, the document is being loaded

 (2)complete, the document has been loaded

How to use document appropriately What about .readyState? The most appropriate way to use document.readyState is to use it to implement an indicator that the document has been loaded. Until this property is widely supported, implementing such an indicator will still require the onload event handler to set a label indicating that the document has been loaded. The following example is as follows

HTML code

梦龙小站

Copy after login

JavaScript code