SVG Tiny 1.2 - 20071117

O ECMAScript Language Binding for SVG

Contents

This appendix is normative.

O.1 Module dom

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.
DOMException.VALIDATION_ERR
This constant is of type Number and its value is 16.
DOMException.TYPE_MISMATCH_ERR
This constant is of type Number and its value is 17.
Object DOMException
The DOMException object has the following properties:
code
This property is of type Number.
Object Node
The Node object has the following properties:
namespaceURI
This property is of type String.
localName
This property is of type String.
parentNode
This property is of type Node.
ownerDocument
This property is of type Document.
textContent
This property is of type String.
The Node object has the following methods:
appendChild(newChild)
This method returns a(n) Node. The newChild parameter is of type Node.
insertBefore(newChild, refChild)
This method returns a(n) Node. The newChild parameter is of type Node. The refChild parameter is of type Node.
removeChild(oldChild)
This method returns a(n) Node. The oldChild parameter is of type Node.
cloneNode(deep)
This method returns a(n) Node. The deep parameter is of type Boolean.
Object Element

Element has all the properties and methods of Node, ElementTraversal as well as the properties and methods defined below.

The Element object has the following methods:
getAttributeNS(namespaceURI, localName)
This method returns a(n) 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.
getAttribute(name)
This method returns a(n) 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.
Object Document

Document has all the properties and methods of Node as well as the properties and methods defined below.

The Document object has the following properties:
implementation
This property is of type DOMImplementation.
documentElement
This property is of type Element.
The Document object has the following methods:
createElementNS(namespaceURI, qualifiedName)
This method returns a(n) Element. The namespaceURI parameter is of type String. The qualifiedName parameter is of type String.
getElementById(elementId)
This method returns a(n) Element. The elementId parameter is of type String.
Object ElementTraversal
The ElementTraversal object has the following properties:
firstElementChild
This property is of type Element.
lastElementChild
This property is of type Element.
nextElementSibling
This property is of type Element.
previousElementSibling
This property is of type Element.
Object DOMImplementation

O.2 Module events

Object EventTarget
The EventTarget object has the following methods:
addEventListener(type, listener, useCapture)
This method has no return value. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type Boolean.
removeEventListener(type, listener, useCapture)
This method has no return value. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type Boolean.
addEventListenerNS(namespaceURI, type, listener, useCapture, evtGroup)
This method has no return value. The namespaceURI parameter is of type String. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type Boolean. The evtGroup parameter is of type Object.
removeEventListenerNS(namespaceURI, type, listener, useCapture)
This method has no return value. The namespaceURI parameter is of type String. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type Boolean.
Function EventListener

In ECMAScript, an EventListener can be specified in one of two ways. The first is an ECMAScript Function object, where the function itself is considered to be the implementation of the handleEvent operation. The second is an ECMAScript object with a property handleEvent, which provides the implementation of the handleEvent operation. If an ECMAScript Function object also has a handleEvent property, then that handleEvent property and not the Function itself is considered to be the implementation of the handleEvent operation.

The EventListener object has the following methods:
handleEvent(evt)
This method has no return value. The evt parameter is of type Event.
Object Event
The Event object has the following properties:
target
This property is of type EventTarget.
currentTarget
This property is of type EventTarget.
type
This property is of type String.
namespaceURI
This property is of type String.
cancelable
This property is of type Boolean.
defaultPrevented
This property is of type Boolean.
The Event object has the following methods:
stopPropagation()
This method has no return value.
preventDefault()
This method has no return value.
Object MouseEvent

MouseEvent has all the properties and methods of UIEvent as well as the properties and methods defined below.

The MouseEvent object has the following properties:
screenX
This property is of type Number.
screenY
This property is of type Number.
clientX
This property is of type Number.
clientY
This property is of type Number.
button
This property is of type Number.
Object MouseWheelEvent

MouseWheelEvent has all the properties and methods of MouseEvent as well as the properties and methods defined below.

The MouseWheelEvent object has the following properties:
wheelDelta
This property is of type Number.
Object TextEvent

TextEvent has all the properties and methods of UIEvent as well as the properties and methods defined below.

The TextEvent object has the following properties:
data
This property is of type String.
Object KeyboardEvent

KeyboardEvent has all the properties and methods of UIEvent as well as the properties and methods defined below.

The KeyboardEvent object has the following properties:
keyIdentifier
This property is of type String.
Object UIEvent

UIEvent has all the properties and methods of Event as well as the properties and methods defined below.

The UIEvent object has the following properties:
detail
This property is of type Number.
Object ProgressEvent

ProgressEvent has all the properties and methods of Event as well as the properties and methods defined below.

The ProgressEvent object has the following properties:
lengthComputable
This property is of type Boolean.
loaded
This property is of type Number.
total
This property is of type Number.
Prototype Object ConnectionEvent
The ConnectionEvent class has the following constants:
ConnectionEvent.NO_ERR
This constant is of type Number and its value is 0.
ConnectionEvent.NETWORK_ERR
This constant is of type Number and its value is 1.
Object ConnectionEvent

ConnectionEvent has all the properties and methods of Event as well as the properties and methods defined below.

The ConnectionEvent object has the following properties:
errorCode
This property is of type Number.
receivedData
This property is of type Object (but see Sequences below for details).

O.3 Module smil

Object ElementTimeControl
The ElementTimeControl object has the following methods:
beginElementAt(offset)
This method has no return value. The offset parameter is of type Number.
beginElement()
This method has no return value.
endElementAt(offset)
This method has no return value. The offset parameter is of type Number.
endElement()
This method has no return value.
Object TimeEvent

TimeEvent has all the properties and methods of Event as well as the properties and methods defined below.

The TimeEvent object has the following properties:
detail
This property is of type Number.

O.4 Module global

Object Global
Prototype Object GlobalException
The GlobalException class has the following constants:
GlobalException.NOT_CONNECTED_ERR
This constant is of type Number and its value is 1.
GlobalException.ENCODING_ERR
This constant is of type Number and its value is 2.
GlobalException.DENIED_ERR
This constant is of type Number and its value is 3.
GlobalException.UNKNOWN_ERR
This constant is of type Number and its value is 4.
Object GlobalException
The GlobalException object has the following properties:
code
This property is of type Number.
Object Connection

Connection has all the properties and methods of EventTarget as well as the properties and methods defined below.

The Connection object has the following properties:
connected
This property is of type Boolean.
The Connection object has the following methods:
connect(host, port)
This method has no return value. The host parameter is of type String. The port parameter is of type Number.
send(data)
This method has no return value. The data parameter is of type Object (but see Sequences below for details).
close()
This method has no return value.
Object Timer

Timer has all the properties and methods of events::EventTarget as well as the properties and methods defined below.

The Timer object has the following properties:
delay
This property is of type Number.
repeatInterval
This property is of type Number.
running
This property is of type Boolean.
The Timer object has the following methods:
start()
This method has no return value.
stop()
This method has no return value.

O.5 Module svg

Prototype Object SVGException
The SVGException class has the following constants:
SVGException.SVG_WRONG_TYPE_ERR
This constant is of type Number and its value is 0.
SVGException.SVG_INVALID_VALUE_ERR
This constant is of type Number and its value is 1.
SVGException.SVG_MATRIX_NOT_INVERTABLE
This constant is of type Number and its value is 2.
Object SVGException
The SVGException object has the following properties:
code
This property is of type Number.
Object SVGDocument

SVGDocument has all the properties and methods of Document, EventTarget as well as the properties and methods defined below.

The SVGDocument object has the following properties:
global
This property is of type SVGGlobal.
Object SVGElementInstance

SVGElementInstance has all the properties and methods of EventTarget as well as the properties and methods defined below.

The SVGElementInstance object has the following properties:
correspondingElement
This property is of type SVGElement.
correspondingUseElement
This property is of type SVGElement.
Prototype Object SVGSVGElement
The SVGSVGElement class has the following constants:
SVGSVGElement.NAV_AUTO
This constant is of type Number and its value is 1.
SVGSVGElement.NAV_NEXT
This constant is of type Number and its value is 2.
SVGSVGElement.NAV_PREV
This constant is of type Number and its value is 3.
SVGSVGElement.NAV_UP
This constant is of type Number and its value is 4.
SVGSVGElement.NAV_UP_RIGHT
This constant is of type Number and its value is 5.
SVGSVGElement.NAV_RIGHT
This constant is of type Number and its value is 6.
SVGSVGElement.NAV_DOWN_RIGHT
This constant is of type Number and its value is 7.
SVGSVGElement.NAV_DOWN
This constant is of type Number and its value is 8.
SVGSVGElement.NAV_DOWN_LEFT
This constant is of type Number and its value is 9.
SVGSVGElement.NAV_LEFT
This constant is of type Number and its value is 10.
SVGSVGElement.NAV_UP_LEFT
This constant is of type Number and its value is 11.
Object SVGSVGElement

SVGSVGElement has all the properties and methods of SVGLocatableElement, SVGTimedElement as well as the properties and methods defined below.

The SVGSVGElement object has the following properties:
currentScale
This property is of type Number.
currentRotate
This property is of type Number.
currentTranslate
This property is of type SVGPoint.
viewport
This property is of type SVGRect.
The SVGSVGElement object has the following methods:
getCurrentTime()
This method returns a(n) Number.
setCurrentTime(seconds)
This method has no return value. The seconds parameter is of type Number.
createSVGMatrixComponents(a, b, c, d, e, f)
This method returns a(n) SVGMatrix. The a parameter is of type Number. The b parameter is of type Number. The c parameter is of type Number. The d parameter is of type Number. The e parameter is of type Number. The f parameter is of type Number.
createSVGRect()
This method returns a(n) SVGRect.
createSVGPoint()
This method returns a(n) SVGPoint.
createSVGPath()
This method returns a(n) SVGPath.
createSVGRGBColor(red, green, blue)
This method returns a(n) SVGRGBColor. The red parameter is of type Number. The green parameter is of type Number. The blue parameter is of type Number.
moveFocus(motionType)
This method has no return value. The motionType parameter is of type Number.
setFocus(theObject)
This method has no return value. The theObject parameter is of type EventTarget.
getCurrentFocusedObject()
This method returns a(n) EventTarget.
Object SVGRGBColor
The SVGRGBColor object has the following properties:
red
This property is of type Number.
green
This property is of type Number.
blue
This property is of type Number.
Object SVGRect
The SVGRect object has the following properties:
x
This property is of type Number.
y
This property is of type Number.
width
This property is of type Number.
height
This property is of type Number.
Object SVGPoint
The SVGPoint object has the following properties:
x
This property is of type Number.
y
This property is of type Number.
The SVGPoint object has the following methods:
matrixTransform(matrix)
This method returns a(n) SVGPoint. The matrix parameter is of type SVGMatrix.
Prototype Object SVGPath
The SVGPath class has the following constants:
SVGPath.MOVE_TO
This constant is of type Number and its value is 77.
SVGPath.LINE_TO
This constant is of type Number and its value is 76.
SVGPath.CURVE_TO
This constant is of type Number and its value is 67.
SVGPath.QUAD_TO
This constant is of type Number and its value is 81.
SVGPath.CLOSE
This constant is of type Number and its value is 90.
Object SVGPath
The SVGPath object has the following properties:
numberOfSegments
This property is of type Number.
The SVGPath object has the following methods:
getSegment(cmdIndex)
This method returns a(n) Number. The cmdIndex parameter is of type Number.
getSegmentParam(cmdIndex, paramIndex)
This method returns a(n) Number. The cmdIndex parameter is of type Number. The paramIndex parameter is of type Number.
moveTo(x, y)
This method has no return value. The x parameter is of type Number. The y parameter is of type Number.
lineTo(x, y)
This method has no return value. The x parameter is of type Number. The y parameter is of type Number.
quadTo(x1, y1, x2, y2)
This method has no return value. The x1 parameter is of type Number. The y1 parameter is of type Number. The x2 parameter is of type Number. The y2 parameter is of type Number.
curveTo(x1, y1, x2, y2, x3, y3)
This method has no return value. The x1 parameter is of type Number. The y1 parameter is of type Number. The x2 parameter is of type Number. The y2 parameter is of type Number. The x3 parameter is of type Number. The y3 parameter is of type Number.
close()
This method has no return value.
Object SVGMatrix
The SVGMatrix object has the following methods:
getComponent(index)
This method returns a(n) Number. The index parameter is of type Number.
mMultiply(secondMatrix)
This method returns a(n) SVGMatrix. The secondMatrix parameter is of type SVGMatrix.
inverse()
This method returns a(n) SVGMatrix.
mTranslate(x, y)
This method returns a(n) SVGMatrix. The x parameter is of type Number. The y parameter is of type Number.
mScale(scaleFactor)
This method returns a(n) SVGMatrix. The scaleFactor parameter is of type Number.
mRotate(angle)
This method returns a(n) SVGMatrix. The angle parameter is of type Number.
Object SVGLocatable
The SVGLocatable object has the following methods:
getBBox()
This method returns a(n) SVGRect.
getScreenCTM()
This method returns a(n) SVGMatrix.
getScreenBBox()
This method returns a(n) SVGRect.
Object SVGLocatableElement

SVGLocatableElement has all the properties and methods of SVGElement, SVGLocatable as well as the properties and methods defined below.

Object TraitAccess
The TraitAccess object has the following methods:
getTrait(name)
This method returns a(n) String. The name parameter is of type String.
getTraitNS(namespaceURI, name)
This method returns a(n) String. The namespaceURI parameter is of type String. The name parameter is of type String.
getFloatTrait(name)
This method returns a(n) Number. The name parameter is of type String.
getFloatListTrait(name)
This method returns a(n) Object (but see Sequences below for details). The name parameter is of type String.
getMatrixTrait(name)
This method returns a(n) SVGMatrix. The name parameter is of type String.
getRectTrait(name)
This method returns a(n) SVGRect. The name parameter is of type String.
getPathTrait(name)
This method returns a(n) SVGPath. The name parameter is of type String.
getRGBColorTrait(name)
This method returns a(n) SVGRGBColor. The name parameter is of type String.
getPresentationTrait(name)
This method returns a(n) String. The name parameter is of type String.
getPresentationTraitNS(namespaceURI, name)
This method returns a(n) String. The namespaceURI parameter is of type String. The name parameter is of type String.
getFloatPresentationTrait(name)
This method returns a(n) Number. The name parameter is of type String.
getFloatListPresentationTrait(name)
This method returns a(n) Object (but see Sequences below for details). The name parameter is of type String.
getMatrixPresentationTrait(name)
This method returns a(n) SVGMatrix. The name parameter is of type String.
getRectPresentationTrait(name)
This method returns a(n) SVGRect. The name parameter is of type String.
getPathPresentationTrait(name)
This method returns a(n) SVGPath. The name parameter is of type String.
getRGBColorPresentationTrait(name)
This method returns a(n) SVGRGBColor. The name parameter is of type String.
setTrait(name, value)
This method has no return value. The name parameter is of type String. The value parameter is of type String.
setTraitNS(namespaceURI, name, value)
This method has no return value. The namespaceURI parameter is of type String. The name parameter is of type String. The value parameter is of type String.
setFloatTrait(name, value)
This method has no return value. The name parameter is of type String. The value parameter is of type Number.
setFloatListTrait(name, value)
This method has no return value. The name parameter is of type String. The value parameter is of type Object (but see Sequences below for details).
setMatrixTrait(name, matrix)
This method has no return value. The name parameter is of type String. The matrix parameter is of type SVGMatrix.
setRectTrait(name, rect)
This method has no return value. The name parameter is of type String. The rect parameter is of type SVGRect.
setPathTrait(name, path)
This method has no return value. The name parameter is of type String. The path parameter is of type SVGPath.
setRGBColorTrait(name, color)
This method has no return value. The name parameter is of type String. The color parameter is of type SVGRGBColor.
Object SVGElement

SVGElement has all the properties and methods of Element, EventTarget, TraitAccess as well as the properties and methods defined below.

The SVGElement object has the following properties:
id
This property is of type String.
Object SVGTimedElement

SVGTimedElement has all the properties and methods of SVGElement, smil::ElementTimeControl as well as the properties and methods defined below.

The SVGTimedElement object has the following properties:
isPaused
This property is of type Boolean.
The SVGTimedElement object has the following methods:
pauseElement()
This method has no return value.
resumeElement()
This method has no return value.
Object SVGAnimationElement

SVGAnimationElement has all the properties and methods of SVGTimedElement as well as the properties and methods defined below.

Object SVGVisualMediaElement

SVGVisualMediaElement has all the properties and methods of SVGLocatableElement, SVGTimedElement as well as the properties and methods defined below.

Object SVGGlobal

SVGGlobal has all the properties and methods of Global as well as the properties and methods defined below.

The SVGGlobal object has the following properties:
document
This property is of type Document.
parent
This property is of type Global.
The SVGGlobal object has the following methods:
createConnection()
This method returns a(n) Connection.
createTimer(initialInterval, repeatInterval)
This method returns a(n) Timer. The initialInterval parameter is of type Number. The repeatInterval parameter is of type Number.
gotoLocation(newIRI)
This method has no return value. The newIRI parameter is of type String.
binaryToString(octets, encoding)
This method returns a(n) String. The octets parameter is of type Object (but see Sequences below for details). The encoding parameter is of type String.
stringToBinary(data, encoding)
This method returns a(n) Object (but see Sequences below for details). The data parameter is of type String. The encoding parameter is of type String.
getURL(iri, callback)
This method has no return value. The iri parameter is of type String. The callback parameter is of type AsyncStatusCallback.
postURL(iri, data, callback, type, encoding)
This method has no return value. The iri parameter is of type String. The data parameter is of type String. The callback parameter is of type AsyncStatusCallback. The type parameter is of type String. The encoding parameter is of type String.
parseXML(data, contextDoc)
This method returns a(n) Node. The data parameter is of type String. The contextDoc parameter is of type Document.
Object AsyncStatusCallback
The AsyncStatusCallback object has the following methods:
operationComplete(status)
This method has no return value. The status parameter is of type AsyncURLStatus.
Object AsyncURLStatus
The AsyncURLStatus object has the following properties:
success
This property is of type Boolean.
contentType
This property is of type String.
content
This property is of type String.

O.6 Sequences

In the ECMAScript language binding, a value of type sequence<T> is represented by an ECMAScript object, hereafter called the sequence object.

The sequence object must have a length property whose value is a non-negative integer Number, which gives the length of the sequence.

For each index in the range [0, length), the sequence object must have a property (an index property) whose name is the index and whose value gives the element of the sequence at that index. When returned from a host object (that is, when an operation whose return type is sequence<T> is called, or when an attribute whose type is sequence<T> is retrieved), then the element values returned from these properties must be of a type as follows:

When passed to a host object (that is, when passed as an operation argument whose type is sequence<T>, or when assigned to an attribute whose type is sequence<T> is assigned to), then the value of each index property gives the element value as follows:

Note that this specification does not define how sequences of types other than float or octet are handled, since these types are not required by the SVG uDOM.

O.6.1 The ToUint8 operator

The ToUint8 operator coerces an ECMAScript Number to an integer value in the range [0, 255]. It is defined analogously to the ToUint32 operator defined in section 9.5 of the ECMAScript Language Specification [ECMA-262]), as follows:

  1. Call ToNumber on the input argument.
  2. If Result(1) is NaN, +0, −0, +∞, or −∞, return +0.
  3. Compute sign(Result(1)) * floor(abs(Result(1))).
  4. Compute Result(3) modulo 28.
  5. Return Result(4).