Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
vy le oai4,697 Points
Could someone please explain the diagram showing the inheritance between EventTarget, Node and Document at https://developer.mozilla.org/en-US/docs/Web/API/Document
I also want to ask one question: As far as I understand, Event.target is something related to only events Node is a primarily data type for the entire DOM. They can include: document node, element node, text node, comment node, atrribute node. Document is one kind of node
Is it correct? And am I missing something? If so, could you please add something to complete it?
The last question, may be related to the first one, is that I saw window object has many properties like onclick, onclose, onchange, oncopy, etc.. and this is the same to other HTML element objects. So is there an inheritance here?
Thank you very much for your help!
Steven Parker225,770 Points
It sounds like you have a good handle on it already. As you observed, Document is one kind of node. This is part of what is being shown in the diagram. The rest of what the diagram is showing is that a Node is one kind of EventTarget.
As to your other question, onclick, onclose, onchange, oncopy, etc. are apparently properties common to GlobalEventHanders like Elements, Document, and Window. But GlobalEventHandlers is what they call a "mixin" and not an object type or interface which would be inherited.