Document Element Node EventTarget

Posted Jun 16, 20201 min read

Document Element Node EventTarget

The bottommost interface of document is the EventTarget interface, and the bottommost parent class is the Node object, which inherits EventTarget,

The description of EventTarget in MDN is:
EventTarget is a DOM interface implemented by objects that can receive events and create listeners.

EventTarget

In summary:all dom elements have methods in EventTarget

Element The interface itself is a function, created with the Node object constructor Node(){} as the original version, and its prototype has a part of document.__proto__.__proto\ The properties and methods in \, MDN "says that all objects under the Document object inherit from it ", but the document is actually an object constructed by the Document() {} object instead of Element(){}. Both of these constructors use the Node object as the prototype to build the object, so it may not belong to inheritance, but Some kind of aggregation relationship.
[Class Relationship]( https://blog.csdn.net/weixin_42927264/article/details/82963556?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none- task-blog-BlogCommendFromMachineLearnPai2-1.nonecase)

Window Actually there is nothing to say, it is a global variable itself, the original version is WindowProperties