????1??DOM?е????н???????Node?????IE9????DOM??????COM?????????????DOM????????nodeType???????????????????????12???????

 

1 Node.ELEMENT_NODE
2 Node.ATTRIBUTE_NODE
3 Node.TEXT_NODE
4 Node.CDATA_SECTION_NODE
5 Node.ENTITY_REFERENCE_NODE
6 Node.ENTITY_NODE
7 Node.PROCESSING_INSTRUCTION_NODE
8 Node.COMMENT_NODE
9 Node.DOCUMENT_NODE
10 Node.DOCUMENT_TYPE_NODE
11 Node.DOCUMENT_FRAGMENT_NODE
12 Node.NOTATION_NODE

 

???????У?1??2??3??9??10??11????????????????????????????·?????
????elementNode.nodeType === Node.ELEMENT_NODE // ??IE??IE9???????????Node????
????elementNode.nodeType === 1 // ?????????
????2?????·????????????????NodeList????
????1 elementNode.childNodes
????2 document.getElementsByName()
????3 document.getElementsByClassName()
????4 document.getElementsByTagName() //????HtmlCollection??????NodeList????????????namedItem('name')????
????5 document.getElementsByTagNameNS()
????NodeList????????????????length?????????????Array???????????NodeList?е??????????item??????[]??????η???NodeList?????????????????????β???????????????NodeList???????????

 

1     function nl2array(nodeList){
2        var array = null;
3        try{
4          array = Array.prototype.slice.call(nodeList?? 0);// FF
5        }catch(){
6          array = [];
7          for (var i = 0?? len = nodeList.length; i < len; i++){
8             array.push(nodeList[i]);
9          }
10        }
11        return array;
12      }