Under construction.
Create TOC (may take a while).
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
---|---|---|---|---|---|---|
appendChild()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.appendChild(y) Make node y the last child of node x .If you append a node that's somewhere else in the document, it moves to the new position. |
||||||
appendData()
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
x.appendData(' some extra text') Appends the string some extra text to x, which must be a text node. | ||||||
applyElement()
MS extension to Level 1 Core
Test page |
Yes | Yes | No | No | No | No |
x.applyElement(y) Make node x a child of node y Even in Explorer on Windows, this method only applies the actual node, not its content (text, for instance). Not recommended. |
||||||
attributes[index]
Level 1 Core
Test page DO NOT USE |
Incorrect and Value, not object |
Incorrect | Incorrect and Value, not object |
Yes | Yes | Yes |
x.attributes[1]
Explorer 5 (Win and Mac) initially give the value of the attribute, while all other
browsers give the attribute object . x.attributes[1].value also gives the value in
all Explorers.
On Windows, the list of attributes is alphabetical in Explorer 5.0 and 5.5, random in 6.0 (and Mac). Use getAttribute() instead.
|
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
attributes[key]
Level 1 Core
Test page DO NOT USE |
Value, not object | Yes | Value, not object and bug | Yes | No | No |
x.attributes['align'] For accessing an attribute by its name. Because of the total confusion with index numbers this would be the best method for using the attributes[] array, except that Safari and Opera
don't support it.
Explorer 5 Win and Mac initially access the value, not the object. In Explorer Mac the attributes['key'] of self-defined attributes does not have
any properties.
Use getAttribute() instead.
|
||||||
childNodes[]
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.childNodes[1] The second child node of node x . |
||||||
children[]
MS extension to Level 1 Core
Test page |
Yes | Yes | Yes | No | Yes | Yes |
x.children[1] The second element child node of node x .Where childNodes holds all child nodes, children only holds those
that are element nodes (HTML tags).
|
||||||
clearAttributes()
MS extension to Level 1 Core
Test page |
No event handlers | No event handlers | No | No | No | No |
x.clearAttributes() Remove all attributes from node x Explorer doesn't clear event handlers. |
||||||
cloneNode()
Level 1 Core
Test page |
Yes | Yes | No event handlers | Yes | Yes | Yes |
x = y.cloneNode(true | false) Make node x a copy of node y . If the argument is true , the entire tree below y
is copied, if it's false only the root node y is copied.
Explorer 5 Mac doesn't clone the event handlers of the element. |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
contains()
(unclear)
Test page |
Yes | Yes | Yes | No | Buggy | Yes |
x.contains(document.getElementById('test')) If node x has a descendant with ID=test, it is true , else false .
In Safari the method always seems to return true, even when the node is not a descendant. |
||||||
createAttribute()
Level 1 Core
Test page DOES NOT WORK |
No | Minimal support | Minimal support | Minimal support | No | No |
x = document.createAttribute('title','Test Title') Create a new attribute title with value Test Title and temporarily place it in node x .
I have not succeeded in actually inserting the attribute into any node through setAttributeNode (which I think would be the correct way).
|
||||||
createDocument()
Level 2 Core
Test page; main test is the Import XML script |
No | No | No | Yes | Minimal support | No |
x = document.implementation.createDocument('','',null) Safari supports the basic function, but not the importing of XML. |
||||||
createDocumentType()
Level 2 Core
Test page |
No | No | No | Minimal support | Minimal support | No |
document.implementation.createDocumentType() Not tested beyond minimal support. |
||||||
createDocumentFragment()
Level 1 Core
|
No tests yet | |||||
createElement()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x = document.createElement('P') Create a new HTML element <P> and temporarily place it in node x .
This node is later inserted into the document.Explorer Windows and Opera also support ('<P>') .
|
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
createTextNode()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x = document.createTextNode('text') Create a text node with content text and temporarily place it in node x
This node is later inserted into the document.
|
||||||
data
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.data The content of x , which must be a text node. Equivalent to x.nodeValue .Can also be set: x.data = 'The new text' . | ||||||
deleteData()
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
x.deleteData(4,3) Delete some data from x , which must be a text node, starting at the fifth character and
deleting three characters.Second argument is required. | ||||||
documentElement
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
document.documentElement Represents the HTML tag and thus the entire HTML document. documentElement can hold interesting information about the dimensions of the document and/or the window. However, it's not exactly easy to use. See the document.body and doctypes page for more information. |
||||||
doctype
Level 1 Core
|
No tests yet | |||||
firstChild
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.firstChild The first child of node x . |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
getAttribute()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | No event handlers |
x.getAttribute('align') The value of the attribute align of node x .Doesn't work on event handlers in Opera. |
||||||
getAttributeNode()
Level 1 Core
Test page |
No | Yes | Value, not object | Yes | Yes | Yes |
x.getAttributeNode('align') Get the attribute align of node x . This is an object, not a value.
Explorer 5 on Mac returns a value, not an object. |
||||||
getElementById()
Level 1 HTML, Level 2 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x = document.getElementById('test') Take the element with ID="test" (wherever it is in the document) and put it in x . Now you can
use all methods and properties on x and the element with ID="test" will change accordingly.This is the equivalent of document.layers and document.all in the Version 4 browsers and it is
necessary to make your DHTML work. |
||||||
getElementsByName()
Level 1 Core/HTML
Test page Do not use |
Few elements; also counts IDs | Few elements; also counts IDs | Few elements | Yes | Most elements | Most elements |
x = document.getElementsByName('MapNode') Make x into an array of all elements with NAME="MapNode" in the documentIn my test the following tags have this name: <P> ,
<INPUT> ,
<IMG> and
<PPK> .Explorer only accepts the INPUT and IMG. Opera and Safari also accept the P. Only Mozilla accepts the PPK tag (which, of course, I invented myself). Explorer on Windows adds elements with ID="MapNode" to the array. |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
getElementsByTagName()
Level 1 Core
Test page |
1 minor bug | Yes | 1 minor bug | Yes | 2 minor bugs | 1 minor bug |
x = document.getElementsByTagName('P') Make x into an array of all P's in the document,
so x[1] is the second P etc.
y .
|
||||||
getNamedItem()
Level 1 Core
|
No tests yet | |||||
hasAttribute()
Level 2 Core
Test page |
No | No | No | Yes | Yes | Buggy |
x.hasAttribute('align') Is true when node x has an attribute 'align'.
Else it is false.In Opera it seems to mean canHaveAttribute() . Opera doesn't accept event handlers
or special attributes you define yourself. In my example I ask whether x has a
class attribute. Although it doesn't, Opera nonetheless answers true .
|
||||||
hasAttributes()
Level 2 Core
Test page |
No | No | No | Yes | Yes | Yes |
x.hasAttributes() Is true when node x has attributes.
|
||||||
hasChildNodes()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.hasChildNodes() Is true when node x has child nodes.
|
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
hasFeature()
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
document.implementation.hasFeature('XML','1.0') Is true if the browser supports XML 1.0 in. See the test page for a fuller list of possible features. |
||||||
implementation
Level 1 Core
Test page |
No | Minimal support | Minimal support | Yes | Weird | Yes |
document.implementation In itself implementation does nothing. It should contain the methods
createCSSStyleSheet(), createDocument(), createDocumentType(), createHTMLDocument()
and hasFeature(). I don't know why these methods need a special interface.Since in Explorer implementation contains nothing it could as well
have been left out.Do the first test twice in Safari. The second time all functions will be mentioned twice in the alert. |
||||||
importNode()
Level 2 Core
| No tests yet | |||||
insertBefore()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.insertBefore(y,z) Insert node y as a child of node x just before node z .
|
||||||
insertData()
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
x.insertData(4,' and now for some extra text ') Insert the string and now for some extra text after the fourth character
into x , which must be a text node. | ||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
isSupported()
Level 2 Core
Test page |
No | No | No | Minimal support | Minimal support | Minimal support |
x.isSupported(y,'1.0') See if node x supports feature y version 1.0 . Roughly the same as
hasFeature , except that it works on a single element.Not tested beyond minimal support. |
||||||
item()
Level 1 Core
Test page Not necessary |
Yes | Yes | Yes | Yes | Yes | Yes |
document.getElementsByTagName('P'). The first element in the array created by document.getElementsByTagName('P') .
It is completely equivalent to x.getElementsByTagName('P')[0] .This method is meant for other languages than JavaScript, where NodeLists like getElementsByTagName are not conveniently made into arrays. Since JavaScript does this automatically you don't need item() at all. |
||||||
lastChild
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.lastChild The last child of node x . |
||||||
mergeAttributes()
MS extension to Level 1 Core
Test page |
Vague | Yes | No | No | No | No |
x.mergeAttributes(y) Copy all of node y 's attributes to node x .In my previous tests there were problems with IE5.0 . Not retested. |
||||||
name
Level 1 Core
Test page |
Only XML attributes | Yes | Yes | Yes | Yes | Yes |
x.name The name of attribute x .
|
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
nextSibling
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.nextSibling The next child of the parent of x . |
||||||
nodeName
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.nodeName The name of node x . For a text node it is #text , for an element node
the HTML tag and for an attribute its name. |
||||||
nodeType
Level 1 Core
Test page |
Bug in 5.0 | Yes | Yes | Yes | Yes | Yes |
x.nodeType is 1 for a tagis 2 for an attributeis 3 for textExplorer 5.0 on Windows assigns no nodeType to attributes. Solved in 5.5 |
||||||
nodeValue
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Bug |
x.nodeValue The value of node x , which must be a text node or an attribute.You can also set the nodeValue: x.nodeValue = 'new value' You can't set the nodeValue of an attribute in Opera. |
||||||
normalize()
Level 1 Core
Test page |
No | Crash | Yes | Yes | Yes | Yes |
x.normalize() All child nodes of node x that are text nodes and have as siblings other text nodes, are merged with those.
This is in fact the reverse of splitText : text nodes that were split, come together again.Minor Safari bug: it removes the incorrect whitespace splitText() caused. |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
ownerDocument
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
x.ownerDocument Refers to the document object that 'owns' node x . This is not the HTML tag but
the root document node.
|
||||||
parentNode
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.parentNode The parent node of x . |
||||||
previousSibling
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.previousSibling The previous child of the parent of x . |
||||||
removeAttribute()
Level 1 Core
Test page |
Yes | Yes | No | Yes | Partial | Minimal support |
x.removeAttribute('align') Remove the align attribute of node x .
Safari doesn't remove style. |
||||||
removeAttributeNode()
Level 1 Core
Test page | No | Minimal support | Minimal support | Yes | No | Yes |
x.removeAttributeNode(x.attributes['align']) or x.removeAttributeNode(x.attributes[1]) |
||||||
removeChild()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.removeChild(y) Remove child y of node x . |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
removeNamedItem()
Level 1 Core
|
No tests yet | |||||
removeNode()
MS extension to Level 1 Core
Test page |
Yes | Yes | No | No | No | Yes |
x.removeNode(true | false) Remove node x from the document. If you add true its children are also removed.
|
||||||
replaceChild()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.replaceChild(y,z) Replace node z , a child of node x , by node y . |
||||||
replaceData()
Level 1 Core
Test page |
No | Yes | Buggy | Yes | Yes | Yes |
x.replaceData(4,3,' and for some new text ') Replace three characters, beginning at the fifth one, of node x , which must be a text node,
by the string and for some new text .In Explorer 5 on Mac the three characters are replaced by the first three characters of the new string, while the other characters of the new string are ignored. | ||||||
replaceNode()
MS extension to Level 1 Core
Test page |
Yes | Yes | No | No | No | No |
x.replaceNode(y) Replace node x by node y . |
||||||
setAttribute()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Partial |
x.setAttribute('align','left') Set the attribute align of node x to left . The name and value are both strings.General rule: don't use setAttribute() when a better way of setting the attribute is available (ie. x.style.display="none" instead of x.setAttribute('style,'display: none') ).
Opera refuses to set a new value of ALIGN. Adding a new INPUT with a type attribute set by this method does not work in Explorer 5 on Mac. Old notes, not retested: Explorer 5 special effects: When you set the attribute style , the style of the element doesn't change.
Attribute name is not allowed. Attribute names must be lower case. |
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
setAttributeNode()
Level 1 Core
Test page DOES NOT WORK |
No | Minimal support | Minimal support | Minimal support | No | No |
z = document.createAttribute('title','Test Title') x.setAttributeNode(z) No browser adds the title attribute to the element. In general this way of creating attributes does not work. |
||||||
setNamedItem()
Level 1 Core
|
No tests yet | |||||
specified
Level 1 Core
Test page DO NOT USE |
Yes | Yes | Yes | Useless | Useless and buggy | Useless |
x.attributes['align'].specified or x.attributes[1].specified Is true when node x has an align attribute, false when it hasn't.So it's meant to find out whether a node has a certain attribute. It's getting tricky now.
|
||||||
Method or property | Explorer 5 Windows | Explorer 6 Windows | Explorer 5 Mac | Mozilla 1.2 | Safari 1.0 beta | Opera 7 beta2 |
splitText()
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Buggy | Yes |
x.splitText(5) Split the text node x at the 6th character. x now contains the first part (char. 0-5), while a new
node is created (and becomes x.nextSibling ) which contains the second part (char. 6-end) of the orginial text.
Safari bug: it adds whitespace between the two text nodes. |
||||||
substringData()
Level 1 Core
Test page |
No | Yes | Yes | Yes | Yes | Yes |
x.substringData(4,3) Takes a substring of x , which must be a text node, starting at the fifth character and with a length of three
characters. Thus it's the same as the old
substr() method of strings.Since substringData() isn't supported by Explorer 5
on Windows, I advise you to use y.data.substr(4,3) instead. |
||||||
swapNode()
MS extension to Level 1 Core
Test page |
Yes | Yes | No | No | No | No |
x.swapNode(y) Put node x in node y 's place and vice versa.
|
||||||
tagName
Level 1 Core
Test page |
Yes | Yes | Yes | Yes | Yes | Yes |
x.tagName The name of node x , which must be a element node (HTML tag). |
||||||
value
Level 1 Core
Test page |
Only XML attributes | Yes | Yes | Yes | Yes | Yes |
x.value The value of attribute x .
|
If you know of a method or property not listed here, please mail me.