📜  什么是节点 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:05.505000             🧑  作者: Mango

代码示例1
Is a child of EventTarget
Node = DOM objects =  Attr, CharacterData (which Text, Comment, and CDATASection are all based on), ProcessingInstruction, DocumentType, Notation, Entity, and EntityReference.
function isNode(o){
  return (
    typeof Node === "object" ? o instanceof Node : 
    o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
  );
}