How quickly obtain the document type node

Use: document.doctype

document.doctype; 
// <!doctype html>
document.doctype === document.firstChild

 

note: 

1. This property returns the value is not a string, but an object;

2. document.firstChild document.doctype and is generally equal;

3. If the document is not a document type declaration, or null

4. Document two nodes are generally nodes, generally DOCTYPE first, second generally html

Guess you like

Origin www.cnblogs.com/aisowe/p/11531208.html