首页 > 代码库 > EventTarge Node Docuement Element HTMLElement 关系

EventTarge Node Docuement Element HTMLElement 关系

综述:

可以将其看做是依次继承的关系:

技术分享

 

Node

Node

A Node is an interface from which a number of DOM types inherit, and allows these various types to be treated (or tested) similarly(好几种dom类型都继承自node接口,这些dom类型对外会表现的很相似).

The following interfaces(下面的这些接口都继承自Node的方法和属性,包括Document节点、Element节点等等) all inherit from Node its methods and properties: Document, Element, CharacterData (which Text, Comment, and CDATASection inherit), ProcessingInstruction, DocumentFragment, DocumentType, Notation, Entity, EntityReference

技术分享

 

These interfaces may return null in particular cases where the methods and properties are not relevant. They may throw an exception - for example when adding children to a node type for which no children can exist.

Document

Document

Document接口为浏览器中的任何网页提供了统一的接口

The Document interface represents any web page loaded in the browser(浏览器中的任何网页) and serves as an entry point into the web page‘s content, which is the DOM tree. The DOM tree includes elements such as <body> and <table>, among many others. It provides functionality global to the document, like how to obtain the page‘s URL and create new elements in the document.

技术分享

 

The Document interface describes the common properties and methods for any kind of document(为任何一种document文档都提供了普遍的属性和方法)Depending on the document‘s type(根据文档类型的不同,HTML类型的提供了HTMLDocument接口,XML和SVG提供了XMLDocument接口) (e.g. HTML, XML, SVG, …), a larger API is available: HTML documents, served with the text/html content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocumentinterface.

Element

Element

The Element interface represents an object of a Document.This interface describes methods and properties common to all kinds of elements.

Element接口表示Document中的一个对象。这个接口为所有的Element接口提供了通用的方法和属性。

 

Specific behaviors are described in interfaces which inherit from Element but add additional functionality(Element中的HTMLElement,SVGElement都继承自Element,并且有自己附加的方法和属性). For example, the HTMLElement interface is the base interface for HTML elements, while the SVGElement interface is the basis for all SVG elements.

Languages outside the realm of the Web platform, like XUL through the XULElementinterface, also implement it.

技术分享

HTMLElement

HTMLElement

The HTMLElement interface represents any HTML element. Some elements directly implement this interface, others implement it via an interface that inherits it.

技术分享

 

EventTarge Node Docuement Element HTMLElement 关系