js nodeType

modun1986發表於2009-03-20

Element (nodeType = 1): This matches most elements in an XML file. For example, <li>,
<a>, <p>, and <body> elements all have a nodeType of 1.

 

 


Text (nodeType = 3): This matches all text segments within your document. When navigat-
ing through a DOM structure using previousSibling and nextSibling you’ll frequently
encounter pieces of text inside and in between elements.

 


Document (nodeType = 9): This matches the root element of a document. For example,
in an HTML document it’s the <html> element.

 

 

相關文章