Throughout the dining table below I list title given to new interface/constructor one instantiates typically the most popular node versions as well as their related nodeType group by the number and you can label. What i hope you take from the desk lower than are this new nodeType value (we.age. 1) merely good numeric classificaiton used to identify a specific type from node manufactured from a certain JavaScript interface/constructor. Such as for instance, the newest HTMLBodyElement screen reprsents a node target who has good node sorts of step 1, which is a meaning getting Feature_NODE’s.
Brand new DOM specification semantically names nodes particularly Node, Element, Text, Attr, and you may HTMLAnchorElement because a program, it was, but bear in mind its and the label made available to the JavaScript constructor form you to constructs the newest nodes. As you read this book I will be speaking about such interfaces (we.e. Feature, Text, Attr, HTMLAnchorElement) given that items or constructor attributes due to the fact requirements relates to him or her since connects.
The new Characteristic_NODE is not actually element of a tree but detailed to possess historic explanations. Within this guide Really don’t provide a chapter for the characteristic nodes and you can alternatively speak about her or him regarding Feature node chapter given you to features nodes try sub-such as for instance nodes out of element nodes no particiipation regarding the real DOM tree construction. Observe the newest Feature_NODE will be depreciated inside DOM 4.
I’ve perhaps not integrated outline within publication towards Feedback_NODE nevertheless should be aware that statements for the an enthusiastic HTML document try Comment nodes and equivalent in the wild so you’re able to Text nodes.
Whenever i discuss nodes from the book I am able to rarely send so you’re able to a certain node having its nodeType term (age.grams. ELEMENT_NODE). This is accomplished becoming in line with verbiage included in the fresh requirement provided with the W3C WHATWG.
Each node object in a typical DOM tree inherits properties and methods from Node. Depending upon the type of node in the document there are also additional sub node object/interfaces that extend the Node object. Below I detail the inheritance model implemented by browsers for the most common node interfaces (< indicates inherited from).
- Object < Node < Element < HTMLElement < (e.g. HTML*Element)
- Object < Node < Attr (This is deprecated in DOM 4)
- Object < Node < CharacterData < Text
- Object < Node < Document < HTMLDocument
- Object < Node < DocumentFragment
And so logically Node inherits regarding Target
Their important not only to understand that most of the nodes sizes inherit regarding Node but your chain from heredity is long. Including, every HTMLAnchorElement nodes inherit qualities and methods out-of HTMLElement, Element, Node, and you may Target objects.
Notes
To confirm that every node types inherit properties procedures throughout the Node target lets circle over an element node target and you may take a look at its characteristics and techniques (and inherited).
For many who work at the above password into the a web browser your will find more information on services that are available so you’re able to this new element node target. The newest qualities tips inherited from the Node object are located in it checklist including many other passed down services and methods regarding the Function, HTMLElement, HTMLAnchorElement, Node, and you will Object target. Its not my suggest see most of these attributes and you may actions today but simply to point out that most nodes inherit some standard features and methods from its constructor because really as properties on the model strings.
While you are more of visual student check out the inheritance chain denoted of exploring the more than HTML file that have Opera’s DOM inspector.
Notice that brand new anchor node inherits off HTMLAnchorElement, HTMLElement, Function, Node, and you may Target all the revealed on listing of services highlighted that have a grey history. So it genetics chain will bring a lot of common actions and you will services to all the node types.