Back to the index.
DOM methods and properties that are for all implementations, and not just for the JavaScript one. In theory almost all of them should work in any programming language that supports the DOM.
This is the desktop table. See also the mobile table.
Last major update on 3 September 2013.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| createElement()Create a new element Test page | Almost | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| 
var x = document.createElement('P')Create a new HTML element node<P>and temporarily place it inx,
	which is later inserted into the document.
 | |||||||||||||||||||
| createTextNode()Create a new text node Test page | Almost | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| 
var x = document.createTextNode('text')Create a text node with content  
 | |||||||||||||||||||
| Text() constructorTo create text nodes with a constructor. Test page | No | No | No | No | Yes | Yes | |||||||||||||
| var text = new Text('Oh, how quick that fox was!');
 | |||||||||||||||||||
These methods are meant for getting the HTML elements you need from the document.
You must know these methods by heart.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| getElementById()Get the element with this ID Test page Lower case 'd'!! | Almost | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| 
var x = document.getElementById('test')Take the element with  If there is more than one element with  
 | |||||||||||||||||||
| getElementsByClassName()Get a nodeList of the elements with this class. Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| document.getElementsByClassName('test')
document.getElementsByClassName('test test2')The first expression returns a nodeList with all elements that have a  | |||||||||||||||||||
| getElementsGet all tags of this type Test page | Incom | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| 
var x = document.getElementsByTagName('P')Make  
var x = y.getElementsByTagName('P')Gets all paragraphs that are descendants of node  
 | |||||||||||||||||||
| querySelector()Get the first element that conforms to a CSS selector Test page | No | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| document.querySelector('.testClass')
document.querySelector('.testClass + p')Returns the first element that have a  
 | |||||||||||||||||||
| querySelectorAll()Get a nodeList of elements by CSS selector Test page | No | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| document.querySelectorAll('.testClass')
document.querySelectorAll('.testClass + p')Returns a nodeList with all elements that have a  Essentially, this method allows you to use CSS syntax to retrieve elements. 
 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
These four properties give basic information about all nodes. What they return depends on the
node type. They are read-only, except for nodeValue.
There are three basic node types: element nodes (HTML tags), attribute nodes and text nodes. I test these properties for all these three types and added a fourth node type: the document node (the root of all other nodes).
You must know these properties by heart.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | ||||||||||
| nodeNameThe name of the node in UPPER CASE Test page | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||||||||||||
| x.nodeName The name of node  
 
 | ||||||||||||||||||||||||||||
| nodeTypeThe type of the node Test page | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||||||||||||
| x.nodeType The type of node  
 
 | ||||||||||||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | |||||||||||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | ||||||||||
| nodeValueThe value of the node, if any. Read/write Test page | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||||||||||||
| x.nodeValue Get the value of node  x.nodeValue = 'Test' Set the value of node  
 
 | ||||||||||||||||||||||||||||
| tagNameThe tag name of an element node Test page Don't use | Almost | Yes | Yes | Yes | Yes | Yes | ||||||||||||||||||||||
| x.tagName Get the tag name of node  
 My advice is not to use  
 | ||||||||||||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | |||||||||||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | ||||||||||
Five properties and two arrays for walking through the DOM tree. Using these properties, you can reach nodes that are close to the current node in the document structure.
In general you shouldn't use too many of these properties. As soon as you're doing something like
x.parentNode.firstChild.nextSibling.children[2]
your code is too complicated. Complex relationships between nodes can suddenly and unexpectedly change when you alter the document structure, and altering the document structure is the point of the W3C DOM. In general you should use only one or two of these properties per action.
You must know these properties by heart.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| childNodes[]An array with all child nodes of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.childNodes[1] Get the second child node of node  The  
 | |||||||||||||||||||
| firstChildThe first child node of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.firstChild Get the first child node of node  
 | |||||||||||||||||||
| hasChildNodes()Check if the node has child nodes Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.hasChildNodes() Returns  | |||||||||||||||||||
| lastChildThe last child node of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.lastChild Get the last child of node  
 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| nextSiblingThe next sibling node of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.nextSibling Get the next child of the parent of  
 | |||||||||||||||||||
| parentNodeThe parent node of the node Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.parentNode Get the parent node of  | |||||||||||||||||||
| previousSiblingThe previous sibling node of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.previousSibling Get the previous child of the parent of  
 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
A few useful properties that should have been in the DOM from the start but mysteriously weren’t.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| childElementCountThe number of element children Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.childElementCount | |||||||||||||||||||
| children[]An array with all child element nodes of the node Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.children[1] Get the second element child node of node  Where  
 | |||||||||||||||||||
| firstElementChildThe first child that is an element node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.firstElementChild | |||||||||||||||||||
| lastElementChildThe last child that is an element node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.lastElementChild | |||||||||||||||||||
| nextElementSiblingThe next element node sibling Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.nextElementSibling | |||||||||||||||||||
| previousElementSiblingThe previous element node sibling Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.previousElementSibling | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
These five methods allow you to restructure the document. The average DOM script uses at least two of these methods.
The changes in the document structure are applied immediately, the whole DOM tree is altered. The browser, too, will immediately show the changes.
You must know these methods by heart.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| appendChild()Append a child node as the last node to an element Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.appendChild(y) Make node  If you append a node that's somewhere else in the document, it moves to the new position. | |||||||||||||||||||
| cloneNode()Clone a node Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x = y.cloneNode(true | false) Make node  Note: Event handlers are not cloned. This is an error in the spec. Also, eventually  | |||||||||||||||||||
| insertBefore()Insert a node into the child nodes of an element Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.insertBefore(y,z) Insert node  | |||||||||||||||||||
| removeChild()Remove a child node from an element Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.removeChild(y) Remove child  | |||||||||||||||||||
| replaceChild()Replace a child node of an element by another child node Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.replaceChild(y,z) Replace node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
These methods are brand-new. They should have been in the DOM from the start.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| after()Add a node after another node Test page | No | No | No | No | No | ||||||||||||||
| x.after(y) Insert node  | |||||||||||||||||||
| append()Add a node as the last child Test page | No | No | No | No | No | ||||||||||||||
| x.append(y) Insert node  (This is exactly the same as  | |||||||||||||||||||
| before()Add a node before another node Test page | No | No | No | No | No | ||||||||||||||
| x.before(y) Insert node  | |||||||||||||||||||
| prepend()Add a node as the first child Test page | No | No | No | No | No | ||||||||||||||
| x.prepend(y) Insert node  | |||||||||||||||||||
| remove()Remove a node Test page | No | Yes | No | No | Yes | Yes | |||||||||||||
| x.remove() Remove node  No more  | |||||||||||||||||||
| replace()Replace a node by another node Test page | No | No | No | No | No | ||||||||||||||
| x.replace(y) Replace node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
These methods are for manipulating text data, i.e. the contents of text nodes.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| appendData()Append data to a text node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.appendData(' some extra text')Appends the string  | |||||||||||||||||||
| dataThe content of a text node Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.data The content of  Can also be set: x.data = 'The new text' | |||||||||||||||||||
| deleteData()Delete text from a text node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.deleteData(4,3) Delete some data from  | |||||||||||||||||||
| insertData()Insert text into a text node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.insertData(4,' and now for some extra text ') Insert the string  | |||||||||||||||||||
| normalize()Merge adjacent text nodes into one node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.normalize() All child nodes of node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| replaceData()Replace text in a text node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.replaceData(4,3,' and for some new text ') Replace three characters, beginning at the fifth one, of node  | |||||||||||||||||||
| splitText()Split a text node into two text nodes Test page | Buggy | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.splitText(5) Split the text node  
 | |||||||||||||||||||
| substringData()Take a substring of the text in the text node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.substringData(4,3) Takes a substring of  | |||||||||||||||||||
| wholeTextThe text of a text node plus the text in directly adjacent text nodes. Read only. Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| This read-only property is useful if you want to get the entire text at a certain point and don’t want to be bothered by borders between text nodes. | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
A bloody mess. Try influencing attributes in this order:
x.id or y.onclick.getAttribute() or setAttribute().attributes[]. It's worse than anything else.In my view any method or property concerning attribute nodes should also work on the style
attribute, event handlers and custom attributes. If not I judge the method or property incomplete.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| attributes[index]An array with the attributes of a node, accessed by index number, in the order they're
		defined in the source code. Test page Do not use Use getAttribute()instead | Incor | Incor | Yes | Yes | Yes | ||||||||||||||
| x.attributes[1] This array consists of all defined attributes in the source code order . 
 Do yourself a favour and don't use the indexed  | |||||||||||||||||||
| attributes[key]An array with the attributes of a node, accessed by attribute name Test page | Incor | Incom | Almost | Yes | Yes | Yes | Yes | ||||||||||||
| x.attributes['align'] Get the align attribute object of node  
 | |||||||||||||||||||
| createAttribute()Create a new attribute node Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| 
z = document.createAttribute('title');
z.value = 'Test title';
x.setAttributeNode(z)
This creates a title attribute with a value and sets it on node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| getAttribute()Get the value of an attribute Test page | Incom | Almost | Yes | Yes | Yes | Yes | |||||||||||||
| x.getAttribute('align')Gives the value of the align attribute of node  
 | |||||||||||||||||||
| getAttributeNode()Get an attribute node Test page | No | Incom | Almost | Yes | Yes | Yes | Yes | ||||||||||||
| x.getAttributeNode('align')Get the attribute object  
 | |||||||||||||||||||
| hasAttribute()Check if a node has a certain attribute Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.hasAttribute('align')Returns  | |||||||||||||||||||
| hasAttributes()Check if a node has attributes Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.hasAttributes() Returns  | |||||||||||||||||||
| nameThe name of an attribute Test page | No | Yes | Yes | Yes | Almost | Yes | Yes | ||||||||||||
| x.name The name of attribute node  
 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| removeAttribute()Remove an attribute node Test page | Almost | Yes | Weird | Yes | Almost | Yes | Yes | Yes | Yes | ||||||||||
| x.removeAttribute('align')Remove the  
 | |||||||||||||||||||
| removeRemove an attribute node Test page | No | Mini | Almost | Yes | Almost | Yes | Yes | Yes | Yes | ||||||||||
| x.removeAttributeNode(x.attributes['align'])
x.removeAttributeNode(x.attributes[1])
x.removeAttributeNode(x.getAttributeNode('align'))Removes the attribute node. There is little difference with  
 | |||||||||||||||||||
| setAttribute()Set the value of an attribute Test page | Incom | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.setAttribute('align','right')Set the align attribute of node  
 | |||||||||||||||||||
| setAttributeNode() Test page | No | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| x.setAttributeNode(node) Add attribute node  
 | |||||||||||||||||||
| valueThe value of an attribute Test page | No | Incom | Yes | Yes | Yes | Yes | Yes | ||||||||||||
| x.value The value of attribute  
 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
A lot of miscellaneous methods and properties that you'll rarely need. I use only two of them in an actual script.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| compareDocumentGives the relative place of one element compared to another. Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.compareDocumentPosition(y) Compares the document (DOM) position of element  
 All relevant numbers are added, and this sum is returned. So if  | |||||||||||||||||||
| contains()Check whether an element contains another element Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| x.contains(y) If node  | |||||||||||||||||||
| createDocumentCreate a document fragment Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x = document.createDocumentFragment(); x.[fill with nodes]; document.[somewhere].appendChild(x); Create a fragment, add a lot of nodes to it, and then insert it into the document. Note that the fragment itself is not inserted, only its child nodes. | |||||||||||||||||||
| documentElementThe HTML tag Test page | Yes | Yes | Yes | Yes | Yes | ||||||||||||||
| document.documentElement Represents the root element of the XML document. In any HTML document, the
	 | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| getElementsGet elements by their name attribute Test page | Incor | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| var x = document.getElementsByName('test')Create a nodeList with all elements that have  On my test page the
	 
 | |||||||||||||||||||
| isEqualNode()Whether two nodes are the same Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.isEqualNode(y) Returns  | |||||||||||||||||||
| ownerDocumentThe document that 'owns' the element Test page | No | Yes | Yes | Yes | Yes | Yes | |||||||||||||
| x.ownerDocument Refers to the document object that 'owns' node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
As usual Microsoft has extended the standard somewhat. Though sometimes its extensions are
brilliant (innerHTML springs to mind), in the case of the DOM Core they aren't.
Note the difference between W3C and Microsoft methods. The W3C methods are owned by the parent element of the node you want to adjust, the Microsoft methods by the node itself.
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
| applyElement()Something with nodes Test page | Yes | No | No | No | No | ||||||||||||||
| var y = document.createElement('i');
x.applyElement(y)The  | |||||||||||||||||||
| clearAttributes()Remove all attributes from a node Test page | Incom | No | No | No | No | ||||||||||||||
| x.clearAttributes() Remove all attributes from node  
 | |||||||||||||||||||
| mergeCopy all attributes of one node to another node Test page | Yes | No | No | No | No | ||||||||||||||
| x.mergeAttributes(y) Copy all of node  | |||||||||||||||||||
| removeNode()Remove a node Test page | Yes | No | No | No | No | ||||||||||||||
| x.removeNode(true | false) Remove node  | |||||||||||||||||||
| replaceNode()Replace a node by another node Test page | Yes | No | No | No | No | ||||||||||||||
| x.replaceNode(y) Replace node  | |||||||||||||||||||
| sourceIndexThe index number of the node in the page source Test page | Yes | Incor | No | No | No | No | |||||||||||||
| x.sourceIndex Get the  
 | |||||||||||||||||||
| swapNode()Swap two nodes Test page | Yes | No | No | No | No | ||||||||||||||
| x.swapNode(y) Put node  | |||||||||||||||||||
| Method or property | Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||||
| 5.5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 Win | 23 Mac | 23 Linux | 6 | 12 Win | 12 Mac | 12 Linux | 16 Win | 16 Mac | 29 Win | 29 Mac | 29 Linux | |
Desktop browser test array 1.0; September 2013