There are many types of DOM itself, which were introduced in the previous chapter, such as the Element type: which represents element nodes; and the Text type, which represents text nodes;
One DOM type
Type name Description
Node represents a unified interface for all types of values, which is not supported by IE;
Document represents the document type;
Element represents the element node type;
Text represents the text node type;
CommentRepresents the comment type in the document;
CDATASection represents the CDATA area type;
DocumentType represents the document declaration type;
DocumentFragment represents the document fragment type;
Attr represents the attribute node type;
1.Node type
DOM level 1 defines a Node interface, which will be implemented by all node types in the DOM;
This Node interface is implemented as the Node type in JavaScript;
Except for IE, this type can be accessed in all other browsers;
2.Document type
//The Document type represents the document, or the root node of the document, and this node is hidden and has no specific element tag;
document; // document;
document.nodeType; // 9;Type value;
document.childNodes[0]; // DocumentType; first child node object;
document.childNodes[1]; // HTMLHtmlElement; object;
// If you want to directly get the element node object HTMLHtmlElement of the tag, you can use documentElement directly;
document.documentElement; // HTMLHtmlElement;
// Many times you need to get the
tag. The commonly used one before was: document.getElementsByTagName('body')[0];// There is a document declaration before : will be processed as the first node of the browser;
document.doctype; // DocumentType;
// There are some legacy properties and object collections in Document, which can quickly help us handle tasks accurately;
// Attributes
document.title; // Get and set the value of the