27 September, 2000

Appendix C: ECMA Script Language Binding

This appendix contains the complete ECMA Script [ECMAScript] binding for the Level 2 Document Object Model Traversal and Range definitions. The definitions are divided into Traversal, and Range.

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

C.1: Document Object Model Traversal

Object NodeIterator
The NodeIterator object has the following properties:
root
This read-only property is of type Node.
whatToShow
This read-only property is of type int.
filter
This read-only property is of type NodeFilter.
expandEntityReferences
This read-only property is of type boolean.
The NodeIterator object has the following methods:
nextNode()
This method returns a Node.
This method can raise a DOMException.
previousNode()
This method returns a Node.
This method can raise a DOMException.
detach()
This method has no return value.
Class NodeFilter
The NodeFilter class has the following constants:
NodeFilter.FILTER_ACCEPT
This constant is of type short and its value is 1.
NodeFilter.FILTER_REJECT
This constant is of type short and its value is 2.
NodeFilter.FILTER_SKIP
This constant is of type short and its value is 3.
NodeFilter.SHOW_ALL
This constant is of type int and its value is 0xFFFFFFFF.
NodeFilter.SHOW_ELEMENT
This constant is of type int and its value is 0x00000001.
NodeFilter.SHOW_ATTRIBUTE
This constant is of type int and its value is 0x00000002.
NodeFilter.SHOW_TEXT
This constant is of type int and its value is 0x00000004.
NodeFilter.SHOW_CDATA_SECTION
This constant is of type int and its value is 0x00000008.
NodeFilter.SHOW_ENTITY_REFERENCE
This constant is of type int and its value is 0x00000010.
NodeFilter.SHOW_ENTITY
This constant is of type int and its value is 0x00000020.
NodeFilter.SHOW_PROCESSING_INSTRUCTION
This constant is of type int and its value is 0x00000040.
NodeFilter.SHOW_COMMENT
This constant is of type int and its value is 0x00000080.
NodeFilter.SHOW_DOCUMENT
This constant is of type int and its value is 0x00000100.
NodeFilter.SHOW_DOCUMENT_TYPE
This constant is of type int and its value is 0x00000200.
NodeFilter.SHOW_DOCUMENT_FRAGMENT
This constant is of type int and its value is 0x00000400.
NodeFilter.SHOW_NOTATION
This constant is of type int and its value is 0x00000800.
Object NodeFilter
This is an ECMAScript function reference. This method returns a short. The parameter is of type Node.
Object TreeWalker
The TreeWalker object has the following properties:
root
This read-only property is of type Node.
whatToShow
This read-only property is of type int.
filter
This read-only property is of type NodeFilter.
expandEntityReferences
This read-only property is of type boolean.
currentNode
This property is of type Node and can raise a DOMException on setting.
The TreeWalker object has the following methods:
parentNode()
This method returns a Node.
firstChild()
This method returns a Node.
lastChild()
This method returns a Node.
previousSibling()
This method returns a Node.
nextSibling()
This method returns a Node.
previousNode()
This method returns a Node.
nextNode()
This method returns a Node.
Object DocumentTraversal
The DocumentTraversal object has the following methods:
createNodeIterator(root, whatToShow, filter, entityReferenceExpansion)
This method returns a NodeIterator.
The root parameter is of type Node.
The whatToShow parameter is of type int.
The filter parameter is of type NodeFilter.
The entityReferenceExpansion parameter is of type boolean.
This method can raise a DOMException.
createTreeWalker(root, whatToShow, filter, entityReferenceExpansion)
This method returns a TreeWalker.
The root parameter is of type Node.
The whatToShow parameter is of type int.
The filter parameter is of type NodeFilter.
The entityReferenceExpansion parameter is of type boolean.
This method can raise a DOMException.

C.2: Document Object Model Range

Class Range
The Range class has the following constants:
Range.START_TO_START
This constant is of type short and its value is 0.
Range.START_TO_END
This constant is of type short and its value is 1.
Range.END_TO_END
This constant is of type short and its value is 2.
Range.END_TO_START
This constant is of type short and its value is 3.
Object Range
The Range object has the following properties:
startContainer
This read-only property is of type Node and can raise a DOMException on retrieval.
startOffset
This read-only property is of type long and can raise a DOMException on retrieval.
endContainer
This read-only property is of type Node and can raise a DOMException on retrieval.
endOffset
This read-only property is of type long and can raise a DOMException on retrieval.
collapsed
This read-only property is of type boolean and can raise a DOMException on retrieval.
commonAncestorContainer
This read-only property is of type Node and can raise a DOMException on retrieval.
The Range object has the following methods:
setStart(refNode, offset)
This method has no return value.
The refNode parameter is of type Node.
The offset parameter is of type long.
This method can raise a RangeException or a DOMException.
setEnd(refNode, offset)
This method has no return value.
The refNode parameter is of type Node.
The offset parameter is of type long.
This method can raise a RangeException or a DOMException.
setStartBefore(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
setStartAfter(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
setEndBefore(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
setEndAfter(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
collapse(toStart)
This method has no return value.
The toStart parameter is of type boolean.
This method can raise a DOMException.
selectNode(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
selectNodeContents(refNode)
This method has no return value.
The refNode parameter is of type Node.
This method can raise a RangeException or a DOMException.
compareBoundaryPoints(how, sourceRange)
This method returns a short.
The how parameter is of type short.
The sourceRange parameter is of type Range.
This method can raise a DOMException.
deleteContents()
This method has no return value.
This method can raise a DOMException.
extractContents()
This method returns a DocumentFragment.
This method can raise a DOMException.
cloneContents()
This method returns a DocumentFragment.
This method can raise a DOMException.
insertNode(newNode)
This method has no return value.
The newNode parameter is of type Node.
This method can raise a DOMException or a RangeException.
surroundContents(newParent)
This method has no return value.
The newParent parameter is of type Node.
This method can raise a DOMException or a RangeException.
cloneRange()
This method returns a Range.
This method can raise a DOMException.
toString()
This method returns a String.
This method can raise a DOMException.
detach()
This method has no return value.
This method can raise a DOMException.
Object DocumentRange
The DocumentRange object has the following methods:
createRange()
This method returns a Range.
Class RangeException
The RangeException class has the following constants:
RangeException.BAD_BOUNDARYPOINTS_ERR
This constant is of type short and its value is 1.
RangeException.INVALID_NODE_TYPE_ERR
This constant is of type short and its value is 2.
Exception RangeException
The RangeException object has the following properties:
code
This property is of type unsigned short.