Last major update on 25 May 2009.
This series of compatibility tests is sponsored by Vodafone.
These compatibility tables detail support for the W3C DOM Core Level 1 and 2 modules in mobile browsers.
These two methods create new HTML elements which you can then insert into the document.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
createElement()
Create a new element
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
var x = document.createElement('P')Create a new HTML element node <P> and temporarily place it in x ,
which is later inserted into the document.
|
||||||||||||||||||||||||
createTextNode()
Create a new text node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
var x = document.createTextNode('text') Create a text node with content |
These methods are meant for getting the HTML elements you need from the document.
You must know these methods by heart.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
getElementById()
Get the element with this ID
Test page Lower case 'd'!! |
Yes | Almost | Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||
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 |
Yes | No | Yes | No | Yes | No | No | To be tested | To be tested | To be tested | ||||||||||||||
document.getElementsByClassName('test') document.getElementsByClassName('test test2') The first expression returns a nodeList with all elements that have a |
||||||||||||||||||||||||
getElements
Get all tags of this type
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
var x = document.getElementsByTagName('P') Make var x = y.getElementsByTagName('P') Gets all paragraphs that are descendants of node |
||||||||||||||||||||||||
querySelectorAll()
Get a nodeList of elements by CSS selector
Test page |
No | Yes | No | Yes | No | No | To be tested | To be tested | To be tested | |||||||||||||||
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. |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
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.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||||||||||||
nodeName
The name of the node in UPPER CASE
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||||||||||||
x.nodeName The name of node
|
||||||||||||||||||||||||||||||||||
nodeType
The type of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||||||||||||
x.nodeType The type of node
|
||||||||||||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||||||||||||
nodeValue
The value of the node, if any. Read/write
Test page |
Yes | Almost | Yes | Yes | Almost | Yes | Yes | Almost | Almost | To be tested | To be tested | To be tested | ||||||||||||||||||||||
x.nodeValue Get the value of node x.nodeValue = 'Test' Set the value of node
|
||||||||||||||||||||||||||||||||||
tagName
The tag name of an element node
Test page Don't use |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||||||||||||
x.tagName Get the tag name of node
My advice is not to use |
||||||||||||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
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.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
childNodes[]
An array with all child nodes of the node
Test page |
Yes | Almost | Yes | Yes | Almost | Yes | Almost | Almost | To be tested | To be tested | To be tested | |||||||||||||
x.childNodes[1] Get the second child node of node The
|
||||||||||||||||||||||||
children[]
An array with all child element nodes of the node
Test page |
Yes | Yes | Yes | No | To be tested | To be tested | To be tested | |||||||||||||||||
x.children[1] Get the second element child node of node Where |
||||||||||||||||||||||||
firstChild
The first child node of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.firstChild Get the first child node of node |
||||||||||||||||||||||||
lastChild
The last child node of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.lastChild Get the last child of node |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
nextSibling
The next sibling node of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.nextSibling Get the next child of the parent of |
||||||||||||||||||||||||
parentNode
The parent node of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.parentNode Get the parent node of |
||||||||||||||||||||||||
previousSibling
The previous sibling node of the node
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.previousSibling Get the previous child of the parent of |
||||||||||||||||||||||||
sourceIndex
The index number of the node in the page source
Test page |
Yes | No | No | No | To be tested | To be tested | To be tested | |||||||||||||||||
x.sourceIndex Get the |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
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.
Blackberry Incomplete: The Blackberry browser does not execute these tests correctly.
However, I have evidence that appendChild()
and insertBefore()
are supported
correctly in other circumstances, and I assume the same goes for removeChild()
and
replaceChild()
. The only thing the Blackberry doesn’t execute correctly are these
tests themselves.
Opera 8.00 on Motorola: I assume these methods work. I can’t test them because this Opera is locked in mobile mode, which means the test elements don’t have a border and I can’t see whether they behave correctly.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
appendChild()
Append a child node as the last node to an element
Test page |
Yes | Yes | Yes | Incom |
To be tested | To be tested | To be tested | |||||||||||||||||
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 | To be tested | To be tested | To be tested | |||||||||||||||||
x = y.cloneNode(true | false) Make node Later you insert the clone into the document. |
||||||||||||||||||||||||
insertBefore()
Insert a node into the child nodes of an element
Test page |
Yes | Yes | Yes | Incom |
To be tested | To be tested | To be tested | |||||||||||||||||
x.insertBefore(y,z) Insert node |
||||||||||||||||||||||||
removeChild()
Remove a child node from an element
Test page |
Yes | Yes | Yes | Incom |
To be tested | To be tested | To be tested | |||||||||||||||||
x.removeChild(y) Remove child |
||||||||||||||||||||||||
replaceChild()
Replace a child node of an element by another child node
Test page |
Yes | Yes | Yes | Incom |
To be tested | To be tested | To be tested | |||||||||||||||||
x.replaceChild(y,z) Replace node |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
These methods are for manipulating text data, i.e. the contents of text nodes.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
appendData()
Append data to a text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.appendData(' some extra text') Appends the string |
||||||||||||||||||||||||
data
The content of a text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.data The content of Can also be set: x.data = 'The new text' |
||||||||||||||||||||||||
deleteData()
Delete text from a text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.deleteData(4,3) Delete some data from |
||||||||||||||||||||||||
insertData()
Insert text into a text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.insertData(4,' and now for some extra text ') Insert the string |
||||||||||||||||||||||||
normalize()
Merge adjacent text nodes into one node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.normalize() All child nodes of node |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
replaceData()
Replace text in a text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
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 |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.splitText(5) Split the text node |
||||||||||||||||||||||||
substringData()
Take a substring of the text in the text node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.substringData(4,3) Takes a substring of |
||||||||||||||||||||||||
wholeText
The text of a text node plus the text in directly adjacent text nodes. Read only.
Test page |
Yes | No | Yes | No | Yes | To be tested | No | No | To be tested | To be tested | To be tested | |||||||||||||
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. |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
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.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
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
|
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
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 |
Yes | No | Yes | To be tested | No | Yes | To be tested | To be tested | To be tested | |||||||||||||||
x.attributes['align'] Get the align attribute object of node After years in the wilderness | ||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
getAttribute()
Get the value of an attribute
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.getAttribute('align') Gives the value of the align attribute of node |
||||||||||||||||||||||||
getAttributeNode()
Get an attribute node
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.getAttributeNode('align') Get the attribute object |
||||||||||||||||||||||||
hasAttribute()
Check if a node has a certain attribute
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.hasAttribute('align') Returns |
||||||||||||||||||||||||
hasAttributes()
Check if a node has attributes
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.hasAttributes() Returns |
||||||||||||||||||||||||
name
The name of an attribute
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.name The name of attribute node |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
removeAttribute()
Remove an attribute node
Test page |
Incom |
Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.removeAttribute('align') Remove the
|
||||||||||||||||||||||||
remove
Remove an attribute node
Test page |
Incom |
Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
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 |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.setAttribute('align','right') Set the align attribute of node |
||||||||||||||||||||||||
value
The value of an attribute
Test page |
Yes | Yes | Yes | Yes | To be tested | To be tested | To be tested | |||||||||||||||||
x.value The value of attribute | ||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |
A lot of miscellaneous methods and properties that you'll rarely need. I use only two of them in an actual script.
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
compareDocument
Gives the relative place of one element compared to another.
Test page |
Yes | No | Yes | No | Yes | To be tested | No | No | To be tested | To be tested | To be tested | |||||||||||||
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 | Incor |
Yes | To be tested | Yes | No | To be tested | To be tested | To be tested | |||||||||||||||
x.contains(y) If node See this blog post for a Firefox workaround. (And yes, Firefox’s constant refusal to implement this very useful method is becoming extremely annoying.)
|
||||||||||||||||||||||||
createDocument
Create a document fragment
Test page |
Yes | Yes | To be tested | Yes | Incom |
To be tested | To be tested | To be tested | ||||||||||||||||
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.
|
||||||||||||||||||||||||
documentElement
The HTML tag
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
document.documentElement Represents the root element of the XML document. In any HTML document, the
|
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG | ||||
getElements
Get elements by their name attribute
Test page |
Incor |
Incor |
Incor |
Yes | To be tested | Yes | Incom |
Yes | To be tested | To be tested | To be tested | |||||||||||||
var x = document.getElementsByName('test') Create a nodeList with all elements that have On my test page the
|
||||||||||||||||||||||||
hasChildNodes()
Check if the node has child nodes
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.hasChildNodes() Returns |
||||||||||||||||||||||||
item()
Access an item in an array
Test page Not necessary in JavaScript |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
document.getElementsByTagName('P').item(0) The same as The You don't need |
||||||||||||||||||||||||
ownerDocument
The document that 'owns' the element
Test page |
Yes | Yes | To be tested | Yes | Yes | To be tested | To be tested | To be tested | ||||||||||||||||
x.ownerDocument Refers to the document object that 'owns' node |
||||||||||||||||||||||||
Selector | Opera Mobile | Opera Mini 4.2 | S60v3 WebKit | S60v5 WebKit | Default WebKits | Non-default WebKits | NetFront | Blackberry | IE Mobile | Skyfire | Obigo | |||||||||||||
(VF WM) Nokia E66 | (9.5) HTC Touch Diamond | (8.65) SE P1i | (8.00) Motorola V3xx | Nokia E71 | Nokia E66 | Nokia E71 | Samsung i560 | Nokia 5800 | iPhone | Android G1 | Android G2 | Bolt (E71) | Iris (HTC) | Ozone (E71) | Samsung F700 | Sony Ericsson C510 | Blackberry 9500 | HTC Touch Diamond | Nokia E71 | LG |