DOM or Document Object Model is a structured representation of a HTML (or XML) document. It is made of Core DOM, XML DOM and HTML DOM and it is considered to be collection of hierarchy of nondes.

DOM node types

Element ELEMENT_NODE An element.
Attr ATTRIBUTE_NODE An attribute.
Text TEXT_NODE A textual content inside an element.
CDATASection CDATA_SECTION_NODE A CDATA section of a document.
EntityReference ENTITY_REFERENCE_NODE An entity reference.
Entity ENTITY_NODE An entity.
Processing Instruction PROCESSING_INSTRUCTION_NODE A processing instruction.
Comment COMMENT_NODE A comment.
Document DOCUMENT_NODE The entire document (the root).
Document Type DOCUMENT_TYPE_NODE An interface to document's entities.
Document Fragment DOCUMENT_FRAGMENT_NODE A light-weight object.
Notation NOTATION_NODE A notation declared with  DTD.

DOM node type values

1 ELEMENT_NODE Element name null
2 ATTRIBUTE_NODE Attribute name Attribute value
3 TEXT_NODE #text Content of node
4 CDATA_SECTION_NODE #cdata-section Content of node
5 ENTITY_REFERENCE_NODE Entity reference name null
6 ENTITY_NODE Entity name null
7 PROCESSING_INSTRUCTION_NODE target Content of node
8 COMMENT_NODE #comment Comment text
9 DOCUMENT_NODE #document null
10 DOCUMENT_TYPE_NODE doctype name null
11 DOCUMENT_FRAGMENT_NODE #document fragment null
12 NOTATION_NODE Notation name null

DOM methods

appendChild() node, element, docFragment Adds a new child node to the last position of the parent node.
appendData() text, comment, cdata Adds text content to the last position of a node.
cloneNode() node Clones a node together with all atributes.
createDocumentFragment() document Creates empty document fragment nodes.
createElement() document, element Creates an element node.
createFragment() docFragment Creates a document's fragment.
createTextNode() document, text, comment, cdata Creates a text node.
deleteData() text, comment, cdata Deletes text content or part of it from a node.
document.close() document Closes a document's string. document Opens a document's string and reads it as an output.
document.write() document Used to directly add expressions (strings, code...) into a HTML document.
document.writeln() document Same as document.write() except that it also appends a new-line character (\n).
getAttribute() attr Finds an attribute's value by given name.
getElementById() document Finds an element by it's id attribute.
getElementsByTagName() document Finds an array collection of all elements specified by the tagname.
hasAttribute() attr Checks if an element has the attribute.
hasChildNodes() node Checks if a node contains any child nodes.
insertBefore() node, docFragment Inserts a new child node in front of the referenced node.
insertData() text, comment, cdata Inserts text content to the given position in a node.
normalize() text, comment, cdata Combines two or more text nodes into a single one.
removeAttribute() attr Removes the attribute given by its name.
removeChild() node Removes a child node.
replaceChild() node Replaces the old child node with a new one and returns the old one.
replaceData() text, comment, cdata Replaces text content or part of it in a node.
setAttribute() attr Adds a new attribute or changes an existing one to give value.
splitText() text Split text content at the given position.
substringData() text, comment, cdata Extracts characters from a string from and to given positions.

DOM properties

childElementCount Counts all children of an element.
childNodes[] An array collecting all child nodes under a given parent.
children A non-standard property returning an array with element's children.
firstChild Returns the first child of a node.
firstElementChild Returns the first child of an element.
isId Checks if the attribute is of type id and returns true if yes (attr.isid).
lastChild Returns the last child of a node.
lastElementChild Returns the last child of an element.
length Returns number of characters from a text node (data.length or nodeValue.length).
name Returns the attribute's name (
nextElementSibling Returns the next sibling of an element.
nextSibling Returns the next sibling of a node.
nodeName Returns the name of the node.
nodeType Returns the type of the node.
nodeValue Returns the value of the node.
previousElementSibling Returns the previous sibling of an element.
previousSibling Returns the previous sibling of a node.
specified Checks if the attribute is created (whether it is appended or not) (attr.specified).
value Returns the attribute's value (attr.value).

DOM extensions

compareDocumentPosition() method Checks for the positions of two nodes in a document and returns values as their positions.
contains() method Checks if the given element is a descendant of the current element.
createCaption() method Creates a caption element and appends it to the table.
createTFoot() method Creates a tfoot element and appends it to the table.
createTHead() method Creates a thead element and appends it to the table.
deleteCaption() method Deletes the caption element of a table.
deleteTFoot() method Deletes the tfoot element of a table.
deleteTHead() method Deletes the thead element of a table.
document.compactMode property Checks for the browsers compatibility of the rendered page.
document.documentMode property Detects the document mode used by the browser renedring the page.
innerHTML property Sets or returns the HTML syntax within the parent element.
innerText property Sets or returns the text inside the object's (i.e. an element) tags.
outerHTML property Sets or returns the HTML syntax of the parent element (including the parent itself).
outerText property Sets or returns the text of the object (i.e. an element).
scrollByLines() method Automatically scrolls the page by the given number of lines.
scrollByPages() method Automatically scrolls the document by the given number of pages.
scrollIntoView() method Automatically positions (scrolls) the viewport to position on the element regardless if it wasn't visible immediately during page rendering.
scrollIntoViewIfNeeded() method Automatically positions (scrolls) the viewport to position on the element the is not visible immediately during page rendering.
tBodies[] method Returns an array of all tbodies elements of a table.