13 November, 2000

Appendix E: ECMAScript Language Binding

This appendix contains the complete ECMAScript [ECMAScript] binding for the Level 2 Document Object Model Core definitions.

Note: Exceptions handling is only supported by ECMAScript implementation conformant with the Standard ECMA-262 3rd. Edition ([ECMAScript]).

Prototype Object DOMException
The DOMException class has the following constants:
DOMException.INDEX_SIZE_ERR
This constant is of type Number and its value is 1.
DOMException.DOMSTRING_SIZE_ERR
This constant is of type Number and its value is 2.
DOMException.HIERARCHY_REQUEST_ERR
This constant is of type Number and its value is 3.
DOMException.WRONG_DOCUMENT_ERR
This constant is of type Number and its value is 4.
DOMException.INVALID_CHARACTER_ERR
This constant is of type Number and its value is 5.
DOMException.NO_DATA_ALLOWED_ERR
This constant is of type Number and its value is 6.
DOMException.NO_MODIFICATION_ALLOWED_ERR
This constant is of type Number and its value is 7.
DOMException.NOT_FOUND_ERR
This constant is of type Number and its value is 8.
DOMException.NOT_SUPPORTED_ERR
This constant is of type Number and its value is 9.
DOMException.INUSE_ATTRIBUTE_ERR
This constant is of type Number and its value is 10.
DOMException.INVALID_STATE_ERR
This constant is of type Number and its value is 11.
DOMException.SYNTAX_ERR
This constant is of type Number and its value is 12.
DOMException.INVALID_MODIFICATION_ERR
This constant is of type Number and its value is 13.
DOMException.NAMESPACE_ERR
This constant is of type Number and its value is 14.
DOMException.INVALID_ACCESS_ERR
This constant is of type Number and its value is 15.
Object DOMException
The DOMException object has the following properties:
code
This property is of type Number.
Object DOMImplementation
The DOMImplementation object has the following methods:
hasFeature(feature, version)
This method returns a Boolean.
The feature parameter is of type String.
The version parameter is of type String.
createDocumentType(qualifiedName, publicId, systemId)
This method returns a DocumentType object.
The qualifiedName parameter is of type String.
The publicId parameter is of type String.
The systemId parameter is of type String.
This method can raise a DOMException object.
createDocument(namespaceURI, qualifiedName, doctype)
This method returns a Document object.
The namespaceURI parameter is of type String.
The qualifiedName parameter is of type String.
The doctype parameter is a DocumentType object.
This method can raise a DOMException object.
Object DocumentFragment
DocumentFragment has the all the properties and methods of the Node object as well as the properties and methods defined below.
Object Document
Document has the all the properties and methods of the Node object as well as the properties and methods defined below.
The Document object has the following properties:
doctype
This read-only property is a DocumentType object.
implementation
This read-only property is a DOMImplementation object.
documentElement
This read-only property is a Element object.
The Document object has the following methods:
createElement(tagName)
This method returns a Element object.
The tagName parameter is of type String.
This method can raise a DOMException object.
createDocumentFragment()
This method returns a DocumentFragment object.
createTextNode(data)
This method returns a Text object.
The data parameter is of type String.
createComment(data)
This method returns a Comment object.
The data parameter is of type String.
createCDATASection(data)
This method returns a CDATASection object.
The data parameter is of type String.
This method can raise a DOMException object.
createProcessingInstruction(target, data)
This method returns a ProcessingInstruction object.
The target parameter is of type String.
The data parameter is of type String.
This method can raise a DOMException object.
createAttribute(name)
This method returns a Attr object.
The name parameter is of type String.
This method can raise a DOMException object.
createEntityReference(name)
This method returns a EntityReference object.
The name parameter is of type String.
This method can raise a DOMException object.
getElementsByTagName(tagname)
This method returns a NodeList object.
The tagname parameter is of type String.
importNode(importedNode, deep)
This method returns a Node object.
The importedNode parameter is a Node object.
The deep parameter is of type Boolean.
This method can raise a DOMException object.
createElementNS(namespaceURI, qualifiedName)
This method returns a Element object.
The namespaceURI parameter is of type String.
The qualifiedName parameter is of type String.
This method can raise a DOMException object.
createAttributeNS(namespaceURI, qualifiedName)
This method returns a Attr object.
The namespaceURI parameter is of type String.
The qualifiedName parameter is of type String.
This method can raise a DOMException object.
getElementsByTagNameNS(namespaceURI, localName)
This method returns a NodeList object.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
getElementById(elementId)
This method returns a Element object.
The elementId parameter is of type String.
Prototype Object Node
The Node class has the following constants:
Node.ELEMENT_NODE
This constant is of type Number and its value is 1.
Node.ATTRIBUTE_NODE
This constant is of type Number and its value is 2.
Node.TEXT_NODE
This constant is of type Number and its value is 3.
Node.CDATA_SECTION_NODE
This constant is of type Number and its value is 4.
Node.ENTITY_REFERENCE_NODE
This constant is of type Number and its value is 5.
Node.ENTITY_NODE
This constant is of type Number and its value is 6.
Node.PROCESSING_INSTRUCTION_NODE
This constant is of type Number and its value is 7.
Node.COMMENT_NODE
This constant is of type Number and its value is 8.
Node.DOCUMENT_NODE
This constant is of type Number and its value is 9.
Node.DOCUMENT_TYPE_NODE
This constant is of type Number and its value is 10.
Node.DOCUMENT_FRAGMENT_NODE
This constant is of type Number and its value is 11.
Node.NOTATION_NODE
This constant is of type Number and its value is 12.
Object Node
The Node object has the following properties:
nodeName
This read-only property is of type String.
nodeValue
This property is of type String, can raise a DOMException object on setting and can raise a DOMException object on retrieval.
nodeType
This read-only property is of type Number.
parentNode
This read-only property is a Node object.
childNodes
This read-only property is a NodeList object.
firstChild
This read-only property is a Node object.
lastChild
This read-only property is a Node object.
previousSibling
This read-only property is a Node object.
nextSibling
This read-only property is a Node object.
attributes
This read-only property is a NamedNodeMap object.
ownerDocument
This read-only property is a Document object.
namespaceURI
This read-only property is of type String.
prefix
This property is of type String and can raise a DOMException object on setting.
localName
This read-only property is of type String.
The Node object has the following methods:
insertBefore(newChild, refChild)
This method returns a Node object.
The newChild parameter is a Node object.
The refChild parameter is a Node object.
This method can raise a DOMException object.
replaceChild(newChild, oldChild)
This method returns a Node object.
The newChild parameter is a Node object.
The oldChild parameter is a Node object.
This method can raise a DOMException object.
removeChild(oldChild)
This method returns a Node object.
The oldChild parameter is a Node object.
This method can raise a DOMException object.
appendChild(newChild)
This method returns a Node object.
The newChild parameter is a Node object.
This method can raise a DOMException object.
hasChildNodes()
This method returns a Boolean.
cloneNode(deep)
This method returns a Node object.
The deep parameter is of type Boolean.
normalize()
This method has no return value.
isSupported(feature, version)
This method returns a Boolean.
The feature parameter is of type String.
The version parameter is of type String.
hasAttributes()
This method returns a Boolean.
Object NodeList
The NodeList object has the following properties:
length
This read-only property is of type Number.
The NodeList object has the following methods:
item(index)
This method returns a Node object.
The index parameter is of type Number.
Note: This object can also be dereferenced using square bracket notation (e.g. obj[1]). Dereferencing with an integer index is equivalent to invoking the item method with that index.
Object NamedNodeMap
The NamedNodeMap object has the following properties:
length
This read-only property is of type Number.
The NamedNodeMap object has the following methods:
getNamedItem(name)
This method returns a Node object.
The name parameter is of type String.
setNamedItem(arg)
This method returns a Node object.
The arg parameter is a Node object.
This method can raise a DOMException object.
removeNamedItem(name)
This method returns a Node object.
The name parameter is of type String.
This method can raise a DOMException object.
item(index)
This method returns a Node object.
The index parameter is of type Number.
Note: This object can also be dereferenced using square bracket notation (e.g. obj[1]). Dereferencing with an integer index is equivalent to invoking the item method with that index.
getNamedItemNS(namespaceURI, localName)
This method returns a Node object.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
setNamedItemNS(arg)
This method returns a Node object.
The arg parameter is a Node object.
This method can raise a DOMException object.
removeNamedItemNS(namespaceURI, localName)
This method returns a Node object.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
This method can raise a DOMException object.
Object CharacterData
CharacterData has the all the properties and methods of the Node object as well as the properties and methods defined below.
The CharacterData object has the following properties:
data
This property is of type String, can raise a DOMException object on setting and can raise a DOMException object on retrieval.
length
This read-only property is of type Number.
The CharacterData object has the following methods:
substringData(offset, count)
This method returns a String.
The offset parameter is of type Number.
The count parameter is of type Number.
This method can raise a DOMException object.
appendData(arg)
This method has no return value.
The arg parameter is of type String.
This method can raise a DOMException object.
insertData(offset, arg)
This method has no return value.
The offset parameter is of type Number.
The arg parameter is of type String.
This method can raise a DOMException object.
deleteData(offset, count)
This method has no return value.
The offset parameter is of type Number.
The count parameter is of type Number.
This method can raise a DOMException object.
replaceData(offset, count, arg)
This method has no return value.
The offset parameter is of type Number.
The count parameter is of type Number.
The arg parameter is of type String.
This method can raise a DOMException object.
Object Attr
Attr has the all the properties and methods of the Node object as well as the properties and methods defined below.
The Attr object has the following properties:
name
This read-only property is of type String.
specified
This read-only property is of type Boolean.
value
This property is of type String and can raise a DOMException object on setting.
ownerElement
This read-only property is a Element object.
Object Element
Element has the all the properties and methods of the Node object as well as the properties and methods defined below.
The Element object has the following properties:
tagName
This read-only property is of type String.
The Element object has the following methods:
getAttribute(name)
This method returns a String.
The name parameter is of type String.
setAttribute(name, value)
This method has no return value.
The name parameter is of type String.
The value parameter is of type String.
This method can raise a DOMException object.
removeAttribute(name)
This method has no return value.
The name parameter is of type String.
This method can raise a DOMException object.
getAttributeNode(name)
This method returns a Attr object.
The name parameter is of type String.
setAttributeNode(newAttr)
This method returns a Attr object.
The newAttr parameter is a Attr object.
This method can raise a DOMException object.
removeAttributeNode(oldAttr)
This method returns a Attr object.
The oldAttr parameter is a Attr object.
This method can raise a DOMException object.
getElementsByTagName(name)
This method returns a NodeList object.
The name parameter is of type String.
getAttributeNS(namespaceURI, localName)
This method returns a String.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
setAttributeNS(namespaceURI, qualifiedName, value)
This method has no return value.
The namespaceURI parameter is of type String.
The qualifiedName parameter is of type String.
The value parameter is of type String.
This method can raise a DOMException object.
removeAttributeNS(namespaceURI, localName)
This method has no return value.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
This method can raise a DOMException object.
getAttributeNodeNS(namespaceURI, localName)
This method returns a Attr object.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
setAttributeNodeNS(newAttr)
This method returns a Attr object.
The newAttr parameter is a Attr object.
This method can raise a DOMException object.
getElementsByTagNameNS(namespaceURI, localName)
This method returns a NodeList object.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
hasAttribute(name)
This method returns a Boolean.
The name parameter is of type String.
hasAttributeNS(namespaceURI, localName)
This method returns a Boolean.
The namespaceURI parameter is of type String.
The localName parameter is of type String.
Object Text
Text has the all the properties and methods of the CharacterData object as well as the properties and methods defined below.
The Text object has the following methods:
splitText(offset)
This method returns a Text object.
The offset parameter is of type Number.
This method can raise a DOMException object.
Object Comment
Comment has the all the properties and methods of the CharacterData object as well as the properties and methods defined below.
Object CDATASection
CDATASection has the all the properties and methods of the Text object as well as the properties and methods defined below.
Object DocumentType
DocumentType has the all the properties and methods of the Node object as well as the properties and methods defined below.
The DocumentType object has the following properties:
name
This read-only property is of type String.
entities
This read-only property is a NamedNodeMap object.
notations
This read-only property is a NamedNodeMap object.
publicId
This read-only property is of type String.
systemId
This read-only property is of type String.
internalSubset
This read-only property is of type String.
Object Notation
Notation has the all the properties and methods of the Node object as well as the properties and methods defined below.
The Notation object has the following properties:
publicId
This read-only property is of type String.
systemId
This read-only property is of type String.
Object Entity
Entity has the all the properties and methods of the Node object as well as the properties and methods defined below.
The Entity object has the following properties:
publicId
This read-only property is of type String.
systemId
This read-only property is of type String.
notationName
This read-only property is of type String.
Object EntityReference
EntityReference has the all the properties and methods of the Node object as well as the properties and methods defined below.
Object ProcessingInstruction
ProcessingInstruction has the all the properties and methods of the Node object as well as the properties and methods defined below.
The ProcessingInstruction object has the following properties:
target
This read-only property is of type String.
data
This property is of type String and can raise a DOMException object on setting.