document.__proto__ === HTMLDocument.prototype;
HTMLDocument.prototype.__proto__ === Document.prototype;

Untitled

DOM 结构树

Untitled

Untitled

原型链的顶端

document.__proto__ === HTMLDocument.prototype
HTMLDocument.prototype.__proto__ === Document.prototype
Document.prototype.__proto__ === Node.prototype
Node.prototype.__proto__ === EventTarget.prototype
EventTarget.prototype.__proto__ === Object.prototype
Object.prototype.__proto__ === null

判断元素类型

Object.prototype.toString.call(document) // '[object HTMLDocument]'
Object.prototype.toString.call(document.createElement('div')) // '[object HTMLDivElement]'

Untitled