Movatterモバイル変換


[0]ホーム

URL:


SVG Tiny 1.2 – 20081222

A The SVG Micro DOM (uDOM)

Contents

This appendix is normative.

A.1 Introduction

During the later stages of development of the SVG Mobile 1.1 specification [SVGM11] it became obvious that there was a requirement to subset the SVG and XML DOM in order to reduce the burden on implementations. SVG Tiny 1.2 adds new features to the uDOM, allowing for as much necessary functionality as possible, still being suitable for SVG Tiny implementations.

Furthermore, it should be possible to implement the uDOM on devices that support SVG Tiny 1.1 although, in this case, the scripting would be external to the SVG document (since SVG Tiny 1.1 does not support inline scripting).

The goal of the uDOM definition is to provide an API that allows access to initial and computed attribute and property values, to reduce the number of interfaces compared to the traditional SVG DOM, to reduce run-time memory footprint using necessary features of the core XML DOM, as well as the most useful SVG features (such as transformation matrices). A subset of the uDOM (corresponding to SVG Tiny 1.1) is already successfully implemented by various implementations ofJSR 226: Scalable 2D Vector Graphics API for J2ME, compatibility with which is another goal of the uDOM [JSR226].

The uDOM makes normative reference to DOM Level 2 Events [DOM2EVENTS], and informative reference to DOM Level 3 Events [DOM3EVENTS]. A minimal subset of DOM Level 3 Events was included in the uDOM to specify functionality as currently implemented on mobile devices, since DOM Level 3 Events was not yet a Recommendation at the time of publication. It is anticipated that DOM Level 3 Events may change to reflect the needs of the current Web environment, and any conflicting changes will supersede the functionality specified here for later SVG specifications.

TheIDL definition for the uDOM is provided.

This appendix consists of the following parts:

A.2 Overview of the SVG uDOM

The following sections provides an informative overview of the SVG uDOM's key features and constraints.

Note: Like other W3C DOM definitions, the SVG uDOM is programming-language independent. Although this appendix only contains ECMAScript and Java language examples, the SVG uDOM is compatible with other programming languages.

A.2.1 Document access

The SVG uDOM offers access to aDocument object which is the root for accessing other features. The way theDocument object becomes available depends on the usage context. In some languages, such as Java, theDocument object can be obtained by implementing theEventListenerInitializer2 interface. TheSVG user agent will invoke the implementation'sinitializeEventListeners method once the script has been loaded and is ready to bind to the document. TheDocument object is sometimes accessible through other means, for example through theAbstractView::document member which is available on the global object in ECMAScript.

A.2.2 Tree navigation

The SVG uDOM only allows navigation of the document node and the element nodes in the DOM tree. Two options are available for navigating the hierarchy of elements:

TheElementTraversal interface providesfirstElementChild,lastElementChild,previousElementSibling andnextElementSibling, which are particularly suitable for constrained devices [ET]. These traversal mechanisms skip over intervening nodes between element nodes, such as text nodes which might only contain white space.

A.2.3 Element creation

The SVG uDOM allows the creation of new elements using thecreateElementNS method of theDocument interface.

Example: Element creation (Java)
String svgNS = "http://www.w3.org/2000/svg";Element myRect = document.createElementNS(svgNS, "rect");

A.2.4 Element insertion

Elements can be inserted into the document tree by calling theappendChild orinsertBefore methods on theNode that is to be the parent.

Example: Element insertion (ECMAScript)
var svgNS = "http://www.w3.org/2000/svg";// Create a new <rect> elementvar myRect = document.createElementNS(svgNS, "rect");// Set the various <rect> properties before appending...// Add element to the root of the documentvar svgRoot = document.documentElement;svgRoot.appendChild(myRect);// Create a new <ellipse> elementvar myEllipse = document.createElementNS(svgNS, "ellipse");// Set the various <ellipse> properties before insertion...// Insert the ellipse before the rectanglesvgRoot.insertBefore(myEllipse, myRect);

A.2.5 Element removal

An element can be removed from the document tree by calling theremoveChild method on its parentNode.

Example: Element removal (ECMAScript)
var myRect = ...;var myGroup = document.getElementById("myGroup");myGroup.appendChild(myRect);...myGroup.removeChild(myRect);

A.2.6 Attribute and property access

The SVG Tiny 1.2 uDOM supports two ways of accessing XML attributes and CSS properties; the standard way viagetAttributeNS andsetAttributeNS on theElement interface, and via a new concept calledtraits.

A trait is the typed value (e.g. a number, not just a string), associated with an element by an XML attribute or a CSS property. The trait facilities in the SVG uDOM allow for strongly-typed access to certain attribute and property values. For example, there is agetFloatTrait method for getting an attribute or property value directly as afloat, in contrast with thegetAttributeNS method which always returns a string. The trait facilities in the SVG uDOM are available on theTraitAccess interface, which is implemented by all DOM objects representingSVG elements.

Example: Trait Access (Java)
float width = myRect.getFloatTrait("width");width += 10;myRect.setFloatTrait("width", width);

An important difference betweengetTraitNS (along with all other trait getter methods) andgetAttributeNS is thatgetTraitNS returns the computed attribute value butgetAttributeNS returns the specified attribute value (which might not exactly match the original specified value due to the possibility of user agent value normalization as described inAttribute/property normalization).

Example: Difference betweengetTraitNS andgetAttributeNS
<g fill="red">  <rect x="1" y="1" width="5" height="5"/>  <rect fill="inherit" x="1" y="1" width="5" height="5"/></g>

In the above example:

Traits may also be animated, by animating the underlying XML attribute orproperty. To access the animated value of a trait, thegetPresentationTrait, along with the other similarly named presentation trait getter methods on theTraitAccess interface, can be used.

A.2.7 Event listener registration and removal

The SVG uDOM utilizes DOM Level 2 Events, using theEventTarget interface, to support the ability to add and remove event listeners to nodes in a document.

Example: Event Listeners (Java)
class MyEventListener implements EventListener {    public void handleEvent(Event evt) {        // Do whatever is needed here    }}...// Create a listenerEventListener listen1 = new MyEventListener();// Listen to click events, during the bubbling phaseSVGElement myRect = (SVGElement)document.getElementById("myRect");myRect.addEventListener("click", listen1, false);...// Remove the click listenermyRect.removeEventListener("click", listen1, false);

A.2.8 Animation

Animation elements can be started and stopped using the methods available on theElementTimeControl interface.

Example: animation (ECMAScript)
var animateColor = document.getElementById("myAnimation");// Start the animation 2.5 seconds from now.animateColor.beginElementAt(2.5);

A.2.9 Multimedia control

Control of multimedia elements, such as the'audio','video', and'animation' elements is available through a combination of theElementTimeControl andSVGTimedElement interfaces. Some common controls, and the interface methods to access them, are listed below:

Note that SVG 1.2 Tiny does not define controlling the rate of playback (such as fast-forward or reverse) for time container elements. This functionality may be included in a future specification.

A.2.10 Java package naming

The SVG uDOM uses the same Java package names as the upcoming SVG 1.2 Full DOM (e.g.org.w3c.dom,org.w3c.dom.events,org.w3c.dom.svg). This allows Java applications which restrict themselves to the features in the SVG uDOM to also run in implementations that support the SVG 1.2 Full DOM.

A.3 Conforming to the SVG uDOM

This section and all the following are normative. Conforming SVG Viewers must support all constants, attributes and methods of all the interfaces defined in the SVG uDOM unless an interface explicitly allows for exceptions to this rule.

A.3.1 Float values

The SVG uDOM uses IEEE-754 single precision floating point values to representfloat values in the IDL [IEEE-754]. While such values support a number of non-finite values — a set of NaN (Not a Number) values and positive & negative infinity — these values are never used by the uDOM. Thus, unless otherwise specified in the prose for an operation or attribute, aDOMException with error code NOT_SUPPORTED_ERR must be thrown if a non-finite value is passed as an operation argument, or assigned to an attribute, whose type isfloat, or if a list of floating point values containing a non-finite value is passed as an operation argument, or assigned to an attribute, whose type issequence<float>.

In addition, none of the operations or attributes in the uDOM distinguish between positive and negative zero. A negative zero must be treated as a positive zero when passed as an operation argument, or assigned to an attribute, whose type isfloat orsequence<float>.

Operations and attributes in the uDOM will never return a non-finite or negative zero value from an operation or attribute.

A.3.2 Attribute/property normalization

A viewer implementing the uDOM is allowed to returnnormalized attribute values ([DOM3], section 1.4) fromgetAttributeNS and the various trait getter methods (getTrait,getTraitNS,getFloatTrait, etc.) and trait presentation value getter methods (getPresentationTrait,getPresentationTraitNS,getFloatPresentationTrait, etc.). The following is a list of possible attribute normalizations:

Color normalization
"red" may be returned as"rgb(255,0,0)","#ff0000", or another semantically identical form.
Out-of-range normalization
Values that are only of relevance within a certain range may be returned as a value clamped to that range. E.g.fill-opacity="1.3" may be returned as"1".
Numerical precision
"3.0" may be returned as"3","3.00" or another semantically identical form.
Whitespace normalization
" 3.0 " may be returned as"3.0". Whitespace normalization also includes unquoted font names in the'font-family' property. Font family names containing whitespace should be quoted. If quoting is omitted, any whitespace characters before and after the font name may be ignored and any sequence of whitespace characters inside the font name may be converted to a single space.
Font weight normalization
"normal" may be returned as"400","bold" may be returned as"700".
Transform normalization
Any transform value may be returned as the corresponding matrix. E.g."scale(2,2)" may be returned as"matrix(2,0,0,2,0,0)", and"scale(2,2) translate(10,5) rotate(45)" may be returned as"matrix(1.4142, 1.4142, -2.5857, 1.4142, 20, 10)".
Path normalization
The full set of path data comamnds as used by'd' and'path' may be mapped down to a smaller set of commands.
Display normalization
All possible'display' values may be mapped to'none','inline' or'inherit' since they cover all the possible'display' outputs for a pure SVG Tiny 1.2 viewer. For example,"block" may be returned as"inline". For viewers in multiple namespaces, e.g. a CDF viewer, the different'display' properties are of importance and therefore an SVG Tiny 1.2 viewer intended for use in a multiple namespace environment is strongly recommended to keep the full range of'display' values.

A.3.3 Text content access

In the SVG uDOM, there are two alternative ways to access an element's textual content. Text access via theTraitAccess interface is available on allSVGElements. This was available in the SVG Tiny 1.1 uDOM (used in theJSR 226 specification [JSR226]) and is still available in order to keep backward compability. The SVG Tiny 1.2 uDOM specification introduces thetextContent attribute on theNode interface as a more generic text access mechanism.

To access or set the text string value for an element via traits youinvokegetTrait() orsetTrait() on that element and pass#text asthe name of the trait you want to get or set. For example,MyTextElement.setTrait("#text", "Hello");Text access via the#text mechanism must be supported ontext content,'desc','title'and'metadata' elements. Text accessto other elements defined within this specification (seelist of elements) is notsupported and an implementation should ignore any text on these elements.

The result of getting and setting text content via the#text mechanism is exactly the sameas when using thetextContent attribute. Therefore the user shouldbe aware of the fact that styling by child'tspan' elements (i.e.'tspan' elements that are children of the element which text content is retrieved) will be lost if a text string is retrieved from an element and then set back again.

The#text trait is included for compatibility with theJSR 226 specification [JSR226]. It is recommended that where compatibility with JSR 226 implementations is not required content developers usetextContent instead as it is more generally applicable and supports better compatibility with DOM Level 3 Core [DOM3].

A.4Module: dom

A.4.1DOMException

An exception that occurred due to a DOM operation, as defined in theFundamental Interfaces: Core Modulesection ofDOM Level 3 Core([DOM3], section 1.4). Note that since theSVG uDOM is a subset of DOM Level 3 Core, some of the exception codes definedfor this exception may never occur (such asINUSE_ATTRIBUTE_ERR,andVALIDATION_ERR).However, in the interest of facilitating implementations that support both theuDOM and the complete DOM Level 3 Core, none of the exception codes are removed.
IDL Definition
exception DOMException{unsigned short code;};// ExceptionCodeconst unsigned short      INDEX_SIZE_ERR                 = 1;const unsigned short      DOMSTRING_SIZE_ERR             = 2;const unsigned short      HIERARCHY_REQUEST_ERR          = 3;const unsigned short      WRONG_DOCUMENT_ERR             = 4;const unsigned short      INVALID_CHARACTER_ERR          = 5;const unsigned short      NO_DATA_ALLOWED_ERR            = 6;const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;const unsigned short      NOT_FOUND_ERR                  = 8;const unsigned short      NOT_SUPPORTED_ERR              = 9;const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;const unsigned short      INVALID_STATE_ERR              = 11;const unsigned short      SYNTAX_ERR                     = 12;const unsigned short      INVALID_MODIFICATION_ERR       = 13;const unsigned short      NAMESPACE_ERR                  = 14;const unsigned short      INVALID_ACCESS_ERR             = 15;const unsigned short      VALIDATION_ERR                 = 16;const unsigned short      TYPE_MISMATCH_ERR              = 17;
Constants
INDEX_SIZE_ERR
SeeINDEX_SIZE_ERR.
DOMSTRING_SIZE_ERR
SeeDOMSTRING_SIZE_ERR.
HIERARCHY_REQUEST_ERR
SeeHIERARCHY_REQUEST_ERR.
WRONG_DOCUMENT_ERR
SeeWRONG_DOCUMENT_ERR.
INVALID_CHARACTER_ERR
SeeINVALID_CHARACTER_ERR.
NO_DATA_ALLOWED_ERR
SeeNO_DATA_ALLOWED_ERR.
NO_MODIFICATION_ALLOWED_ERR
SeeNO_MODIFICATION_ALLOWED_ERR.
NOT_FOUND_ERR
SeeNOT_FOUND_ERR.
NOT_SUPPORTED_ERR
SeeNOT_SUPPORTED_ERR.
INUSE_ATTRIBUTE_ERR
SeeINUSE_ATTRIBUTE_ERR.
INVALID_STATE_ERR
SeeINVALID_STATE_ERR.
SYNTAX_ERR
SeeSYNTAX_ERR.
INVALID_MODIFICATION_ERR
SeeINVALID_MODIFICATION_ERR.
NAMESPACE_ERR
SeeNAMESPACE_ERR.
INVALID_ACCESS_ERR
SeeINVALID_ACCESS_ERR.
VALIDATION_ERR
SeeVALIDATION_ERR.
TYPE_MISMATCH_ERR
SeeTYPE_MISMATCH_ERR.
No defined attributes
No defined methods

A.4.2Node

TheNode interface describes generic nodes in an SVG document tree.

This interface is a subset of theNode interface defined inDOM Level 3 Core ([DOM3], section 1.4). Node types that must be supported in the uDOM areElement nodes andDocument nodes.

This subset does not support the NodeType and DocumentPosition definition groups, since thenodeType field and thecompareDocumentPosition method are not members of the subsetted interface.

ConcerningtextContent, there is no requirement to create a Text node on setting since this subset has no interface representing Text nodes. However, the behaviour oftextContent must be as if the Text node described in thethe definition of textContent had indeed been created.

An alternate way of accessing text content on elements defined within the SVG specification is with the use ofthe#text trait.

IDL Definition
interface Node{readonly attribute DOMString namespaceURI;readonly attribute DOMString localName;readonly attribute Node parentNode;readonly attribute Document ownerDocument;attribute DOMString textContent;Node appendChild(in Node newChild) raises(DOMException);Node insertBefore(in Node newChild, in Node refChild) raises(DOMException);Node removeChild(in Node oldChild) raises(DOMException);Node cloneNode(in boolean deep);};
No defined constants
Attributes
namespaceURI
SeenamespaceURI.
localName
SeelocalName.
parentNode
SeeparentNode.
ownerDocument
SeeownerDocument.
textContent
SeetextContent.
Methods
appendChild
SeeappendChild.
insertBefore
SeeinsertBefore.
removeChild
SeeremoveChild.
cloneNode
SeecloneNode.

A.4.3Element

TheElement interfacedescribes generic elements in an SVG document tree.

This interface is a subset of theElement interface defined inDOM Level 3 Core ([DOM3], section 1.4).

ConcerningsetAttributeNS, there is no requirement to take theprefix into account since neither theprefix field nor theAttr interface are supported.

IDL Definition
interface Element : Node, ElementTraversal{DOMString getAttributeNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException);void setAttributeNS(in DOMString namespaceURI, in DOMString qualifiedName, in DOMString value) raises(DOMException);DOMString getAttribute(in DOMString name);void setAttribute(in DOMString name, in DOMString value) raises(DOMException);};
No defined constants
No defined attributes
Methods
getAttributeNS
SeegetAttributeNS.
setAttributeNS
SeesetAttributeNS.
getAttribute
SeegetAttribute.
setAttribute
SeesetAttribute.

A.4.4Document

TheDocument interfacerepresents XML documents.

This interface is a subset of theDocument interface defined inDOM Level 3 Core ([DOM3], section 1.4).

IDL Definition
interface Document : Node{Element createElementNS(in DOMString namespaceURI, in DOMString qualifiedName) raises(DOMException);readonly attribute Element documentElement;Element getElementById(in DOMString elementId);};
No defined constants
Attributes
documentElement
SeedocumentElement.
Methods
createElementNS
SeecreateElementNS.
getElementById
SeegetElementById.

A.4.5ElementTraversal

This interface provides a way to traverse elements in the uDOM tree. It is needed mainly because SVG Tiny uDOM does notexpose character data nodes. Each element in the SVG Tiny document tree implements this interface, including elementsin foreign namespaces. For the normative definition of this interface see theElementTraversal specification [ET]; it is only repeated informatively below.
IDL Definition
interface ElementTraversal{readonly attribute Element firstElementChild;readonly attribute Element lastElementChild;readonly attribute Element nextElementSibling;readonly attribute Element previousElementSibling;readonly attribute unsigned long childElementCount;};
No defined constants
Attributes
firstElementChild
SeefirstElementChild.
lastElementChild
SeelastElementChild.
nextElementSibling
SeenextElementSibling.
previousElementSibling
SeepreviousElementSibling.
childElementCount
SeechildElementCount.
No defined methods

A.4.6Location

Location objects provide a representation of their document's address.

IDL Definition
interface Location{void assign(in DOMString iri);void reload();};
No defined constants
No defined attributes
Methods
assign

When this method is invoked, the user agent must navigate to the givenIRI. The result of the traversal must be identical to the traversal caused by an'a' hyperlink with the'target' attribute set to'_replace'. The difference is that the'a' hyperlink is activated on user interaction butassign is activated from script.The current document location is the IRI of theDocument object pointed to by theAbstractView.document field.RelativeIRI references are resolved based on the base IRI of the current document. If the base IRI differs from that of the current document, the current document is discarded, and loading and parsing of the document at the specified IRI then begins. If the previous step resulted in loading of a new document, the timeline is restarted and a new load event is fired.Note: For HTTP, apragma:no-cache ([RFC2616], section 14.32) is not issued and thus a fresh copy from the server is not forced if there is a cache.

Parameters
inDOMStringiriTheIRI to be traversed.
No return value
No exceptions
reload

When this method is invoked, the user agent is forced to reload the resource identified by theLocation. The current document location is theIRI of theDocument object pointed to by theAbstractView.document field.

No parameters
No return value
No exceptions

A.4.7Window

This is a subset of the de facto standard Window interface that many browsers implement. SeeWindow Object 1.0 andThe default view inHTML 5 for ongoing standardization efforts in this area at the time of writing [WINDOW,HTML5].

TheWindow interface must be implemented by the object that represents thedefault view of the document ([DOM2VIEWS], section 1.1). This object also implementsAbstractView. Thus, in the ECMAScript language binding, the global script object implementsWindow. TheWindow object for a document can also be obtained throughDocumentView::defaultView.

IDL Definition
interface Window{readonly attribute Window parent;readonly attribute Location location;};
No defined constants
Attributes
parent

TheWindow object that is the parent view of this document's default view. If theWindow has no notion of parent (e.g. if the document is displayed as the top level document in a viewer), then the value of this attribute isnull.

location

TheLocation object that is for that Window object's active document.

No defined methods

A.5Module: views

SVG Tiny 1.2 requires completeDOM Level 2 Views support, which includes theAbstractView andDocumentView interfaces [DOM2VIEWS].

The SVG Tiny 1.2 uDOM does not provide access to any views of the document other than the default view. The default view is accessible throughDocumentView::defaultView. Note that the default view is required to also implement theSVGGlobal interface. In the ECMAScript language binding, the global script object must also be the object that represents the default view.

A.5.1AbstractView

This interface is a copy of theAbstractView interface fromDOM Level 2 Views ([DOM2VIEWS], section 1.2), and must be implemented by the object that represents the thedefault view of the document. In the ECMAScript language binding, the global script object must implement this interface.

IDL Definition
interface AbstractView{readonly attribute DocumentView document;};
No defined constants
Attributes
document
The document that thisSVGGlobal is associated with, as aDocumentView. Note that this object is also aDocument. SeeAbstractView::document inDOM Level 2 Views ([DOM2VIEWS], section 1.2).
No defined methods

A.5.2DocumentView

This interface is a copy of theDocumentView interface fromDOM Level 2 Views ([DOM2VIEWS], section 1.2), and must be implemented by allDocument objects.

IDL Definition
interface DocumentView{readonly attribute AbstractView defaultView;};
No defined constants
Attributes
defaultView
The defaultAbstractView for thisDocument, ornull if none available.The value of this attribute is theSVGGlobal object associated with the document.SeeDocumentView::defaultView inDOM Level 2 Views ([DOM2VIEWS], section 1.2).
No defined methods

A.6Module: events

A.6.1EventTarget

TheEventTarget interfaceis implemented by objects that can notify listeners about events and allowsregistration and removal ofEventListener objects.

This interface is a subset of theEventTarget interface defined inDOM Level 2 Events ([DOM2EVENTS], section 1.3.1).

Please note that SVG Tiny 1.2 user agents are not required to support the capture phase, and conformant SVG Tiny 1.2 content must not make use of it. If an attempt to specify event operations on the capture phase is made an SVG Tiny user agent that does not support it must ignore them as ifaddEventListener had not been called. (SeeEvent flow for details.)

As indicated in theDOM Level 2 Events definition forEventTarget, this interface is implemented by allNodes.

Refer to theDOM Events Level 2 specification [DOM2EVENTS] or theXML Events [XML-EVENTS] specification introduction for an explanation of the SVG event flow and the meaning of event targets, event current target, bubble and capture.

IDL Definition
interface EventTarget{void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture);void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture);};
No defined constants
No defined attributes
Methods
addEventListener
SeeaddEventListener.
removeEventListener
SeeremoveEventListener.

A.6.2EventListener

TheEventListener interface is implemented by script to handle an event. The interface can be implemented in ECMAScript by using a Function object (or by using an object with ahandleEvent property), and in Java by implementing the interface directly. TheEventListener object can then be registered as a listener usingEventTarget::addEventListener.

This interface is identical to theEventListener interface defined inDOM Level 2 Events ([DOM2EVENTS], section 1.3.1).

IDL Definition
interface EventListener{void handleEvent(in Event evt);};
No defined constants
No defined attributes
Methods
handleEvent
SeehandleEvent.

A.6.3Event

TheEvent interface is used toprovide contextual information about an event to the handler processing the event.

This interface is a subset of theEvent interface defined inDOM Level 2 Events ([DOM2EVENTS, section 1.4), with one addition: thedefaultPrevented attribute. This subset does not support the PhaseType definition group.

For a list of supported event types see theComplete list of supported events section of the Interactivity chapter.

IDL Definition
interface Event{readonly attribute EventTarget target;readonly attribute EventTarget currentTarget;readonly attribute DOMString type;readonly attribute boolean cancelable;readonly attribute boolean defaultPrevented;void stopPropagation();void preventDefault();};
No defined constants
Attributes
target
Seetarget.
currentTarget
SeecurrentTarget.
type
Seetype.
cancelable
Seecancelable.
defaultPrevented
Used to indicate whetherEvent.preventDefault() has been called for this event.
Methods
stopPropagation
SeestopPropagation.
preventDefault
SeepreventDefault.

A.6.4MouseEvent

Event that providesspecific contextual information associated with pointing device events.

Event types that areMouseEvents:click,mousedown,mouseup,mouseover,mousemove,mouseout.

This interface is a subset of theMouseEvent interface defined inDOM Level 2 Events ([DOM2EVENTS, section 1.6.2).

IDL Definition
interface MouseEvent : UIEvent{readonly attribute long screenX;readonly attribute long screenY;readonly attribute long clientX;readonly attribute long clientY;readonly attribute unsigned short button;};
No defined constants
Attributes
screenX
SeescreenX.
screenY
SeescreenY.
clientX
SeeclientX.
clientY
SeeclientY.
button
Seebutton.
No defined methods

A.6.5MouseWheelEvent

Event that providesspecific contextual information associated with mouse wheel events.

Event types that areMouseWheelEvents:mousewheel.

This interface is a subset of theMouseWheelEvent interface defined inDOM Level 3 Events ([DOM3EVENTS], section 1.7.6), and inherits attributes from theMouseEvent interface defined inDOM Level 2 Events ([DOM2EVENTS], section 1.6.2).

IDL Definition
interface MouseWheelEvent : MouseEvent{readonly attribute long wheelDelta;};
No defined constants
Attributes
wheelDelta
The distance the wheel has rotated around the y-axis. A positive value shall indicate that the wheel has been rotated away from the user on vertically-aligned devices or in a left-hand manner on horizontally aligned devices, and a negative value shall indicate that the wheel has been rotated towards the user on vertically-aligned devices or in a right-hand manner on horizontally-aligned devices.
No defined methods

A.6.6TextEvent

Event typethat is aTextEvent:textInput.

This interface is a subset of theTextEvent interface defined inDOM Level 3 Events ([DOM3EVENTS], section 1.7.2).

IDL Definition
interface TextEvent : UIEvent{readonly attribute DOMString data;};
No defined constants
Attributes
data
data holds the value of the characters generated by the character device. This may be a single Unicode character or a non-empty sequence of Unicode characters [UNICODE]. Characters should be normalized to Unicode normalization formNFC, defined inUnicode Normalization Forms [UAX15]. This attribute will not benull or contain an empty string.
No defined methods

A.6.7KeyboardEvent

Provides specific contextual information associated with keyboard devices. EachKeyboardEventreferences a key using an identifier.

Event types that areKeyboardEvents:keydown,keyup.

This interface is a subset of theKeyboardEvent interface defined inDOM Level 3 Events ([DOM3EVENTS], section 1.7.3).

IDL Definition
interface KeyboardEvent : UIEvent{readonly attribute DOMString keyIdentifier;};
No defined constants
Attributes
keyIdentifier
keyIdentifier holds the identifier of the key. The key identifiers are defined in theKey identifiers set, below. Implementations that are unable to identify a key must use the key identifier"Unidentified".
No defined methods

Key identifiers set

This is a subset of thekey identifiers defined inDOM Level 3 Events, and defines a snapshot of functionality currently implemented on mobile devices ([DOM3EVENTS], section A.2).

The list of key identifiers contained in this section is not exhaustive and input devices may have to define their own key identifiers. It is expected that DOM Level 3 Events will define an algorithm to determine which key identifier to use. Future SVG specifications will defer to DOM Level 3 Events for a definitive treatment of keyboard events and key identifiers.

"U+0000","U+0001", ...,"U+10FFFF" are Unicode-based key identifiers [UNICODE]. A user agent may treat string literal characters in content as Unicode codepoints for the purpose of key identification.

"Accept"
The Accept (Commit, OK) key.
"Again"
The Again key.
"AllCandidates"
The All Candidates key.
"Alphanumeric"
The Alphanumeric key.
"Alt"
The Alt (Menu) key.
"AltGraph"
The Alt-Graph key.
"Apps"
The Application key.
"Attn"
The ATTN key.
"BrowserBack"
The Browser Back key.
"BrowserFavorites"
The Browser Favorites key.
"BrowserForward"
The Browser Forward key.
"BrowserHome"
The Browser Home key.
"BrowserRefresh"
The Browser Refresh key.
"BrowserSearch"
The Browser Search key.
"BrowserStop"
The Browser Stop key.
"CapsLock"
The Caps Lock (Capital) key.
"Clear"
The Clear key.
"CodeInput"
The Code Input key.
"Compose"
The Compose key.
"Control"
The Control (Ctrl) key.
"Crsel"
The Crsel key.
"Convert"
The Convert key.
"Copy"
The Copy key.
"Cut"
The Cut key.
"Down"
The Down Arrow key.
"DownLeft"
The diagonal Down-Left Arrow key.
"DownRight"
The diagonal Down-Right Arrow key.
"End"
The End key.
"Enter"
The Enter key.Note: This key identifier is also used for the Return (Macintosh numpad) key.
"EraseEof"
The Erase EOF key.
"Execute"
The Execute key.
"Exsel"
The Exsel key.
"F1"
The F1 key.
"F2"
The F2 key.
"F3"
The F3 key.
"F4"
The F4 key.
"F5"
The F5 key.
"F6"
The F6 key.
"F7"
The F7 key.
"F8"
The F8 key.
"F9"
The F9 key.
"F10"
The F10 key.
"F11"
The F11 key.
"F12"
The F12 key.
"F13"
The F13 key.
"F14"
The F14 key.
"F15"
The F15 key.
"F16"
The F16 key.
"F17"
The F17 key.
"F18"
The F18 key.
"F19"
The F19 key.
"F20"
The F20 key.
"F21"
The F21 key.
"F22"
The F22 key.
"F23"
The F23 key.
"F24"
The F24 key.
"FinalMode"
The Final Mode (Final) key used on some asian keyboards.
"Find"
The Find key.
"FullWidth"
The Full-Width Characters key.
"HalfWidth"
The Half-Width Characters key.
"HangulMode"
The Hangul (Korean characters) Mode key.
"HanjaMode"
The Hanja (Korean characters) Mode key.
"Help"
The Help key.
"Hiragana"
The Hiragana (Japanese Kana characters) key.
"Home"
The Home key.
"Insert"
The Insert (Ins) key.
"JapaneseHiragana"
The Japanese-Hiragana key.
"JapaneseKatakana"
The Japanese-Katakana key.
"JapaneseRomaji"
The Japanese-Romaji key.
"JunjaMode"
The Junja Mode key.
"KanaMode"
The Kana Mode (Kana Lock) key.
"KanjiMode"
The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key.
"Katakana"
The Katakana (Japanese Kana characters) key.
"LaunchApplication1"
The Start Application One key.
"LaunchApplication2"
The Start Application Two key.
"LaunchMail"
The Start Mail key.
"Left"
The Left Arrow key.
"Menu"
The Menu key.
"Meta"
The Meta key.
"MediaNextTrack"
The Media Next Track key.
"MediaPlayPause"
The Media Play Pause key.
"MediaPreviousTrack"
The Media Previous Track key.
"MediaStop"
The Media Stop key.
"ModeChange"
The Mode Change key.
"Nonconvert"
The Nonconvert (Don't Convert) key.
"NumLock"
The Number Lock key.
"PageDown"
The Page Down (Next) key.
"PageUp"
The Page Up key.
"Paste"
The Paste key.
"Pause"
The Pause key.
"Play"
The Play key.
"PreviousCandidate"
The Previous Candidate function key.
"PrintScreen"
The Print Screen (PrintScrn, SnapShot) key.
"Process"
The Process key.
"Props"
The Props key.
"Right"
The Right Arrow key.
"RomanCharacters"
The Roman Characters function key.
"Scroll"
The Scroll Lock key.
"Select"
The Select key.
"SelectMedia"
The Select Media key.
"Shift"
The Shift key.
"Soft1"
The Soft1 key.
"Soft2"
The Soft2 key.
"Soft3"
The Soft3 key.
"Soft4"
The Soft4 key.
"Stop"
The Stop key.
"Up"
The Up Arrow key.
"UpLeft"
The diagonal Up-Left Arrow key.
"UpRight"
The diagonal Up-Right Arrow key.
"Undo"
The Undo key.
"VolumeDown"
The Volume Down key.
"VolumeMute"
The Volume Mute key.
"VolumeUp"
The Volume Up key.
"Win"
The Windows Logo key.
"Zoom"
The Zoom key.
"U+0008"
The Backspace (Back) key.
"U+0009"
The Horizontal Tabulation (Tab) key.
"U+0018"
The Cancel key.
"U+001B"
The Escape (Esc) key.
"U+0020"
The Space (Spacebar) key.
"U+0021"
The Exclamation Mark (Factorial, Bang) key (!).
"U+0022"
The Quotation Mark (Quote Double) key (").
"U+0023"
The Number Sign (Pound Sign, Hash, Crosshatch, Octothorpe) key (#).
"U+0024"
The Dollar Sign (milreis, escudo) key ($).
"U+0026"
The Ampersand key (&).
"U+0027"
The Apostrophe (Apostrophe-Quote, APL Quote) key (').
"U+0028"
The Left Parenthesis (Opening Parenthesis) key (().
"U+0029"
The Right Parenthesis (Closing Parenthesis) key ()).
"U+002A"
The Asterisk (Star) key (*).
"U+002B"
The Plus Sign (Plus) key (+).
"U+0025"
The Percent Sign (Percent) key (+).
"U+002C"
The Comma (decimal separator) sign key (,).
"U+002D"
The Hyphen-minus (hyphen or minus sign) key (-).
"U+002E"
The Full Stop (period, dot, decimal point) key (.).
"U+002F"
The Solidus (slash, virgule, shilling) key (/).
"U+0030"
The Digit Zero key (0).
"U+0031"
The Digit One key (1).
"U+0032"
The Digit Two key (2).
"U+0033"
The Digit Three key (3).
"U+0034"
The Digit Four key (4).
"U+0035"
The Digit Five key (5).
"U+0036"
The Digit Six key (6).
"U+0037"
The Digit Seven key (7).
"U+0038"
The Digit Eight key (8).
"U+0039"
The Digit Nine key (9).
"U+003A"
The Colon key (:).
"U+003B"
The Semicolon key (;).
"U+003C"
The Less-Than Sign key (<).
"U+003D"
The Equals Sign key (=).
"U+003E"
The Greater-Than Sign key (>).
"U+003F"
The Question Mark key (?).
"U+0040"
The Commercial At (@) key.
"U+0041"
The Latin Capital Letter A key (A).
"U+0042"
The Latin Capital Letter B key (B).
"U+0043"
The Latin Capital Letter C key (C).
"U+0044"
The Latin Capital Letter D key (D).
"U+0045"
The Latin Capital Letter E key (E).
"U+0046"
The Latin Capital Letter F key (F).
"U+0047"
The Latin Capital Letter G key (G).
"U+0048"
The Latin Capital Letter H key (H).
"U+0049"
The Latin Capital Letter I key (I).
"U+004A"
The Latin Capital Letter J key (J).
"U+004B"
The Latin Capital Letter K key (K).
"U+004C"
The Latin Capital Letter L key (L).
"U+004D"
The Latin Capital Letter M key (M).
"U+004E"
The Latin Capital Letter N key (N).
"U+004F"
The Latin Capital Letter O key (O).
"U+0050"
The Latin Capital Letter P key (P).
"U+0051"
The Latin Capital Letter Q key (Q).
"U+0052"
The Latin Capital Letter R key (R).
"U+0053"
The Latin Capital Letter S key (S).
"U+0054"
The Latin Capital Letter T key (T).
"U+0055"
The Latin Capital Letter U key (U).
"U+0056"
The Latin Capital Letter V key (V).
"U+0057"
The Latin Capital Letter W key (W).
"U+0058"
The Latin Capital Letter X key (X).
"U+0059"
The Latin Capital Letter Y key (Y).
"U+005A"
The Latin Capital Letter Z key (Z).
"U+005B"
The Left Square Bracket (Opening Square Bracket) key ([).
"U+005C"
The Reverse Solidus (Backslash) key (\).
"U+005D"
The Right Square Bracket (Closing Square Bracket) key (]).
"U+005E"
The Circumflex Accent key (^).
"U+005F"
The Low Sign (Spacing Underscore, Underscore) key (_).
"U+0060"
The Grave Accent (Back Quote) key (`).
"U+007B"
The Left Curly Bracket (Opening Curly Bracket, Opening Brace, Brace Left) key ({).
"U+007C"
The Vertical Line (Vertical Bar, Pipe) key (|).
"U+007D"
The Right Curly Bracket (Closing Curly Bracket, Closing Brace, Brace Right) key (}).
"U+007F"
The Delete (Del) Key.
"U+00A1"
The Inverted Exclamation Mark key (¡).
"U+0300"
The Combining Grave Accent (Greek Varia, Dead Grave) key.
"U+0301"
The Combining Acute Accent (Stress Mark, Greek Oxia, Tonos, Dead Eacute) key.
"U+0302"
The Combining Circumflex Accent (Hat, Dead Circumflex) key.
"U+0303"
The Combining Tilde (Dead Tilde) key.
"U+0304"
The Combining Macron (Long, Dead Macron) key.
"U+0306"
The Combining Breve (Short, Dead Breve) key.
"U+0307"
The Combining Dot Above (Derivative, Dead Above Dot) key.
"U+0308"
The Combining Diaeresis (Double Dot Above, Umlaut, Greek Dialytika, Double Derivative, Dead Diaeresis) key.
"U+030A"
The Combining Ring Above (Dead Above Ring) key.
"U+030B"
The Combining Double Acute Accent (Dead Doubleacute) key.
"U+030C"
The Combining Caron (Hacek, V Above, Dead Caron) key.
"U+0327"
The Combining Cedilla (Dead Cedilla) key.
"U+0328"
The Combining Ogonek (Nasal Hook, Dead Ogonek) key.
"U+0345"
The Combining Greek Ypogegrammeni (Greek Non-Spacing Iota Below, Iota Subscript, Dead Iota) key.
"U+20AC"
The Euro Currency Sign key (€).
"U+3099"
The Combining Katakana-Hiragana Voiced Sound Mark (Dead Voiced Sound) key.
"U+309A"
The Combining Katakana-Hiragana Semi-Voiced Sound Mark (Dead Semivoiced Sound) key.

A.6.8UIEvent

TheUIEvent interfaceprovides specific contextual information associated with user interface events.

Event types that areUIEvents:DOMFocusIn,DOMFocusOut,DOMActivate,MouseEvent,TextEvent,KeyboardEvent,

This interface is a subset of theUIEvent interface defined inDOM Level 2 Events ([DOM2EVENTS, section 1.6.1).

IDL Definition
interface UIEvent : Event{readonly attribute long detail;};
No defined constants
Attributes
detail
Seedetail.
No defined methods

A.6.9ProgressEvent

The progress events defined here are intended to be a subset of those defined inProgress Events 1.0 [PROGRESSEVENTS].

Many resources, such as raster images, movies and complex SVG content can take a substantial amount of time to download. In some use cases the author would prefer to delay the display of content or the beginning of an animation until the entire content of a file has been downloaded. In other cases, the author may wish to give the viewer some feedback that a download is in progress (e.g. a loading progress screen).

TheProgressEvent occurs when the user agent makes progress loading a resource (external) referenced by an'xlink:href' attribute.

The user agent must dispatch aProgressEvent at the beginning of a load operation (i.e. just before starting to access the resource). This event is of typeloadstart.

The user agent must dispatch aProgressEvent at the end of a load operation (i.e. after load is complete and the user agent is ready to render the corresponding resource). This event is of typeloadend.

The user agent may dispatchProgressEvents between theloadstart event and theloadend events. Such events are of typeprogress.

Event types that areProgressEvents:progress,loadstart,loadend.

IDL Definition
interface ProgressEvent : Event{readonly attribute boolean lengthComputable;readonly attribute unsigned long loaded;readonly attribute unsigned long total;};
No defined constants
Attributes
lengthComputable
If false the total number of bytes (total) cannot be computed and the valueof total should be ignored. This might occur if the size of the downloadedresource is unknown or if the data has already arrived.
loaded
Specifies the number of bytes downloaded since the beginning of the download.This value is ignored for aloadstartorloadend event.
total
Specifies the expected total number of bytes expected in a load operation. For aprogress event,it should specify the total number of bytes expected.
No defined methods
Example: ProgressEvent
<svg xmlns="http://www.w3.org/2000/svg"     xmlns:xlink="http://www.w3.org/1999/xlink"     xmlns:ev="http://www.w3.org/2001/xml-events"     version="1.2" baseProfile="tiny" width="300" height="430">  <script><![CDATA[    function showImage(imageHref) {      var image = document.getElementById('myImage');      image.setTraitNS("http://www.w3.org/1999/xlink", "href", imageHref);    }    function imageLoadStart(evt) {      var progressBar = document.getElementById('progressBar');      var loadingAnimation = document.getElementById('loadingAnimation');      progressBar.setFloatTrait("width", 0);      loadingAnimation.beginElement();    }    function imageLoadProgress(evt) {      if (evt.lengthComputable) {        var progressBar = document.getElementById('progressBar');        progressBar.setFloatTrait("width", 100 * (evt.loaded / evt.total));        progressBar.setTrait("display", "inline");      }    }    function imageLoadComplete(evt) {      var progressBar = document.getElementById('progressBar');      var loadingAnimation = document.getElementById('loadingAnimation');      progressBar.setTrait("display", "none");      loadingAnimation.endElement();    }  ]]></script>  <image xml:id="myImage" xlink:href="imageA.png" width="300" height="400">    <handler ev:event="loadstart">      imageLoadStart(evt);    </handler>    <handler ev:event="progress">      imageLoadProgress(evt);    </handler>    <handler ev:event="loadend">      imageLoadComplete(evt);    </handler>  </image>  <rect rx="4" x="50" y="400" width="200" height="30" cursor="pointer">    <handler ev:event="click">      showImage('imageB.png');    </handler>  </rect>  <text x="150" y="420" font-size="15" fill="white" text-anchor="middle"        text-decoration="underline" pointer-events="none">    Load other image  </text>  <g display="none">    <rect x="100" y="300" height="10" width="100" fill="black"/>    <rect xml:id="progressBar" x="100" y="300" width="50" height="10" fill="lime"/>  </g>  <text x="150" y="330" font-size="15" text-anchor="middle" display="none">    Loading...    <animate xml:id="loadingAnimation" attributeName="display"             begin="indefinite" dur="2s" repeatDur="indefinite"             calcMode="discrete" values="inline; none"/>  </text></svg>

A.7Module: smil

Contains a single subsetted interface from the SMIL APIs.

A.7.1ElementTimeControl

This interface defines common methods for elements which define animation behaviors compatible with SMIL (timed elements and the'svg' element).

This interface is a subset of theElementTimeControl interface defined inSMIL Animation [SMILANIM].

Note: See theSVGTimedElement interface for pause functionality.
IDL Definition
interface ElementTimeControl{void beginElementAt(in float offset);void beginElement();void endElementAt(in float offset);void endElement();};
No defined constants
No defined attributes
Methods
beginElementAt
Creates a begin instance time for the current time plus or minus the specified offset. The new instance time is added to thebegin instance times list.
Parameters
infloatoffsetThe offset in seconds at which to begin the element.
No return value
No exceptions
beginElement
Creates a begin instance time for the current time. The new instance time is added to thebegin instance times list.This is equivalent tobeginElementAt(0).
No parameters
No return value
No exceptions
endElementAt
Creates an end instance time for the current time plus or minus the specified offset. The new instance time is added to theend instance times list.
Parameters
infloatoffsetThe offset in seconds at which to end the element.
No return value
No exceptions
endElement
Creates an end instance time for the current time. The new instance time is added to theend instance times list. This is equivalent toendElementAt(0).
No parameters
No return value
No exceptions

A.7.2TimeEvent

TimeEvent is an interface used to provide contextual information for events fired by animations in the document. It is a subset of theTimeEvent interface defined inSMIL Animation ([SMILANIM], section 6.2).

Event that is fired by alltimed elements.

Event types that areTimeEvents:beginEvent,endEvent,repeatEvent.

IDL Definition
interface TimeEvent : Event{readonly attribute long detail;};
No defined constants
Attributes
detail
Specifies detailed information about theTimeEvent, the information depends on the type of event. ForbeginEvent andendEvent thedetail field is not used. ForrepeatEvent thedetail field contains the current repeat iteration.
No defined methods

A.8Module: svg

A.8.1SVGException

An exception thrown for SVG-specific errors.

This interface is identical toSVGException interface defined inSVG 1.1 ([SVG11], section B.3).

IDL Definition
exception SVGException{unsigned short code;};// ExceptionCodeconst unsigned short SVG_WRONG_TYPE_ERR         = 0;const unsigned short SVG_INVALID_VALUE_ERR      = 1;const unsigned short SVG_MATRIX_NOT_INVERTABLE  = 2;
Constants
SVG_WRONG_TYPE_ERR
Seedefinition.
SVG_INVALID_VALUE_ERR
Seedefinition.
SVG_MATRIX_NOT_INVERTABLE
Seedefinition.
No defined attributes
No defined methods

A.8.2SVGDocument

IDL Definition
interface SVGDocument : Document, EventTarget{};
No defined constants
No defined attributes
No defined methods

A.8.3SVGUseElement

This interface represents the'use'element. In SVG 1.2 Tiny this interface has no additional methods to those it inherits; it is included for architectural consistency with other profiles of SVG.
IDL Definition
interface SVGUseElement : SVGLocatableElement{};
No defined constants
No defined attributes
No defined methods

A.8.4SVGElementInstance

For each'use'element, the uDOM represents the referenced content with ashadow tree ofSVGElementInstanceobjects.

This interface is a subset of theSVGElementInstance interface defined inSVG 1.1 ([SVG11], section 5.17).

IDL Definition
interface SVGElementInstance : EventTarget{readonly attribute SVGElement correspondingElement;readonly attribute SVGUseElement correspondingUseElement;};
No defined constants
Attributes
correspondingElement
SeecorrespondingElement.
correspondingUseElement
SeecorrespondingUseElement.
No defined methods

In the example below, three'use' elements use the same'rect' element. Each'use' has different'fill' properties that are inherited down to the used'rect'. The result is three'rect' elements with different'fill' colors. Clicking one of these three'rect' elements will cause a fourth'rect' to change color to match the clicked one. Worth noticing is that if the original'rect' had not been in the'defs' element the script would throw an exception when the original'rect' is clicked. This is because thecurrentTarget attribute would return anSVGElement that doesn't have thecorrespondingUseElement attribute.

Example: Usage of the SVGElementInstance interface (ECMAScript)
<svg xmlns="http://www.w3.org/2000/svg"     xmlns:xlink="http://www.w3.org/1999/xlink"     xmlns:ev="http://www.w3.org/2001/xml-events"     version="1.2" baseProfile="tiny" width="640" height="480" viewBox="0 0 640 480">  <defs>    <rect xml:id="r1" width="90" height="65"/>  </defs>  <use xlink:href="#r1" x="50" y="200" fill="red"/>  <use xlink:href="#r1" x="250" y="200" fill="blue"/>  <use xlink:href="#r1" x="450" y="200" fill="green"/>  <rect xml:id="r2" x="250" y="50" width="90" height="65"/>  <ev:listener observer="r1" event="ev:click" handler="#handler"/>  <handler xml:id="handler" type="application/ecmascript">changeColor(evt);</handler>  <script type="application/ecmascript">    var target = document.getElementById("r2");    function changeColor(evt) {      var useElement = evt.currentTarget.correspondingUseElement;      target.setRGBColorTrait("fill", useElement.getRGBColorTrait("fill"));    }  </script></svg>

A.8.5SVGSVGElement

This interface represents the'svg' element in the SVG document tree.

User Agent Transforms

The uDOM attributescurrentScale,currentRotate andcurrentTranslate are combined to form a user agent transformation which is applied at the outermost level on the SVG document (i.e. outside the'svg' element). Their values can potentially be modified through user agent specific UI, if "magnification" is enabled (i.e.,'zoomAndPan' attribute is set tomagnify). User agent transformation can be obtained by multiplying the matrix

 [currentScale      0       currentTranslate.x]         [cos(currentRotate) -sin(currentRotate 0] [     0      currentScale  currentTranslate.y]  by     [sin(currentRotate) cos(currentRotate) 0] [     0            0               1         ]         [         0                  0         1]

That is, translate, then scale, then rotate the coordinate system. The reference point for scale and rotate operations is the origin (0, 0).

IDL Definition
interface SVGSVGElement : SVGLocatableElement, SVGTimedElement{const unsigned short NAV_AUTO           = 1;const unsigned short NAV_NEXT           = 2;const unsigned short NAV_PREV           = 3;const unsigned short NAV_UP             = 4;const unsigned short NAV_UP_RIGHT       = 5;const unsigned short NAV_RIGHT          = 6;const unsigned short NAV_DOWN_RIGHT     = 7;const unsigned short NAV_DOWN           = 8;const unsigned short NAV_DOWN_LEFT      = 9;const unsigned short NAV_LEFT           = 10;const unsigned short NAV_UP_LEFT        = 11;attribute float currentScale;attribute float currentRotate;readonly attribute SVGPoint currentTranslate;readonly attribute SVGRect viewport;float getCurrentTime();void setCurrentTime(in float seconds);SVGMatrix createSVGMatrixComponents(in float a, in float b, in float c, in float d, in float e,                                     in float f);SVGRect createSVGRect();SVGPoint createSVGPoint();SVGPath createSVGPath();SVGRGBColor createSVGRGBColor(in float red, in float green, in float blue) raises(SVGException);void moveFocus(in unsigned short motionType) raises(DOMException);void setFocus(in EventTarget theObject) raises(DOMException);EventTarget getCurrentFocusedObject();};
Constants
NAV_AUTO
Indicates that focus must move to the next focusable object according to the user agent's own algorithm.
NAV_NEXT
Indicates that focus must move to the next focusableobject according to current'nav-next' value.
NAV_PREV
Indicates that focus must move to the previous focusableobject according to currentnav-prev value.
NAV_UP
Indicates a request that focus must move in the given direction.
NAV_UP_RIGHT
Indicates a request that focus must move in the given direction.
NAV_RIGHT
Indicates a request that focus must move in the given direction.
NAV_DOWN_RIGHT
Indicates a request that focus must move in the given direction.
NAV_DOWN
Indicates a request that focus must move in the given direction.
NAV_DOWN_LEFT
Indicates a request that focus must move in the given direction.
NAV_LEFT
Indicates a request that focus must move in the given direction.
NAV_UP_LEFT
Indicates a request that focus must move in the given direction.
Attributes
currentScale
The current user agent scale (zoom) coefficient. The initial value forcurrentScale is 1.
currentRotate
The current user agent rotation angle in degrees. The initial value forcurrentRotate is 0.
currentTranslate
The current user agent translation used for scrolling or panning. The returnedSVGPoint object is"live" and setting itsx andy components will change the useragent's translation. The initial forcurrentTranslateis anSVGPoint objectwith the value (0, 0).
viewport

The position and size of theviewport (implicit or explicit) that corresponds to this'svg' element. When the user agent is actually rendering the content, then the position and size values represent the actual values when rendering.

If this SVG document is embedded as part of another document (e.g., via the HTML'object' element), then the positionand size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout,then unitless values represent pixel units for the current CSS or XSL viewport, as described in theCSS 2 specification.)If the parent element does not have a coordinate system, then the user agent should provide reasonable default valuesfor this attribute.

For stand-alone SVG documents, both'x' and'y' must be zero, the'width' must be the width of the viewport which the host environment provides to theSVG user agent into which it can render its content, and the'height' must be the height of the viewport, with all values expressed in the pixel coordinate system from the host environment, preferably such that this pixel coordinate system matches the same pixel coordinate system presented to HTML and matches the model for pixel coordinates described in theCSS 2 specification. Note that "pixel coordinate systems" are host-specific. Two possible approaches that hosts might use for pixel coordinate systems are actual device pixels or (particularly for high-resolution devices) pseudo device pixels which exactly match SVG and CSS's "px" coordinates.

The object itself and its contents are both readonly. ADOMException with error code NO_MODIFICATION_ALLOWED_ERRis raised if an attempt is made to modify it. The returnedSVGRect object is "live", i.e. itsx,y,width andheight attributes areautomatically updated if the viewport size or position changes.

Methods
getCurrentTime

Returns thedocument time in seconds.

IfgetCurrentTime is called before the document timeline has begun (for example, by script running in a'script' element before therootmost 'svg' element'sload event is dispatched, when'playbackOrder' is set to'onLoad'), then 0 is returned.

Return value
float The currentdocument time, in seconds, or 0 if the document timeline has not yet begun.
No parameters
No exceptions
setCurrentTime

Sets thedocument time (in seconds). This API is required to support seeking forwards and backwards in the timeline. After a seek, animation continues to play (forwards) from the new time. Ifseconds is negative, then the document will seek to time 0s.

IfsetCurrentTime is called before the document timeline has begun (for example, by script running in a'script' element before therootmost 'svg' element'sload event is dispatched, when'playbackOrder' is set to'onLoad'), then the value ofseconds in the most recent invocation of the method gives the time that the document time will be seeked to once the document timeline has begun.

Parameters
infloatseconds Thedocument time to seek to, in seconds.
No return value
No exceptions
createSVGMatrixComponents
Creates a newSVGMatrix object. This object can be used to modify the value of traits which are compatible with theSVGMatrix type using thesetMatrixTrait method. The internal representation of the matrix is as follows:
  [  a  c  e  ]  [  b  d  f  ]  [  0  0  1  ]
Parameters
infloataThea component of the matrix to be set.
infloatbTheb component of the matrix to be set.
infloatcThec component of the matrix to be set.
infloatdThed component of the matrix to be set.
infloateThee component of the matrix to be set.
infloatfThef component of the matrix to be set.
Return value
SVGMatrixThe createdSVGMatrix object.
No exceptions
createSVGRect
Creates a newSVGRect object. This object can be used to modify the value of traits which are compatible with theSVGRect type using thesetRectTrait method. The initial values forx,y,width andheight of this newSVGRect are zero.
No parameters
Return value
SVGRectThe createdSVGRect.
No exceptions
createSVGPoint
Creates a newSVGPoint object. The initial values forx andy of this newSVGPoint are zero.
No parameters
Return value
SVGPointThe createdSVGPoint.
No exceptions
createSVGPath
Creates a newSVGPath object. This object can be used to modify the value of traits which are compatible with theSVGPathtype using thesetPathTrait method.
No parameters
Return value
SVGPathThe createdSVGPath.
No exceptions
createSVGRGBColor
Creates a newSVGRGBColor object. This object can be used to modify the value of traits which are compatible with theSVGRGBColor type using thesetRGBColorTrait method. The parameters are floats, one per color component. 0.0 represents zero intensity and 255.0 represents full intensity of a given color component. Colors originally in the rgb(%,%,%) syntax may have fractional components. Out of gamut colors may have component values less than 0.0 or greater than 255.0.
Parameters
infloatredThe red component of theSVGRGBColor.
infloatgreenThe green component of theSVGRGBColor.
infloatblueThe blue component of theSVGRGBColor.
Return value
SVGRGBColorThe createdSVGRGBColor.
No exceptions
moveFocus
Moves the current focus to a different object based on the value of the parameter. The user agent must take into account thecurrently focused object in the document in order to find the new focused object.

If this method succeeds:

  • ADOMFocusOut event must be dispatched which has the previously focused object as the event target.
  • After that, aDOMFocusIn event must dispatched which has the the new focused object as the event target.

A reference to the new focused object can be obtained using theEventTarget interface of the generatedDOMFocusIn event.

Refer to thenavigation section for a description of how navigation is managed. The behavior for this method must be the same as if anequivalent move was done by the end user (for example by using a joystick or pressing the Tab key) and not by scripting.

Whenever the method fails (that is, when aDOMException is raised), focus must stay on the currently focused object and noDOMFocusOut/DOMFocusIn event is dispatched.

Note: For stand-alone SVG documents, the user agent must always have a currently focused object. At the beginning, theSVGDocument has focus.

Parameters
inshortmotionTypeThe type of motion.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested motion type is not supported (i.e. not one of the interface constants).
DOMException
INVALID_ACCESS_ERR: Raised if the currently focused object doesn't have anavigation attribute value corresponding to the requested motion type. For instance, if amoveFocus(NAV_UP) is called on an element which has no'nav-up' attribute.
DOMException
INVALID_STATE_ERR: Raised if the currently focused object has anavigation attribute value corresponding to the requested motion type but the target indicated in this attribute can not be found or is not a focusable object. For instance, if amoveFocus(NAV_UP) is called on an object which has a'nav-up' attribute but the value of this attribute references an element which is not focusable.
setFocus
A request to put the focus on the given object.

If this method succeeds:

  • ADOMFocusOut event must be dispatched which has the previously focused object as the event target.
  • After that, aDOMFocusIn event must be dispatched which has the the new focused object as the event target.

A reference to the newly focused object can be obtained using theEventTarget interface of the generatedDOMFocusIn event.

Whenever the method fails (that is, when aDOMException is raised), focus must stay on the currently focused object and noDOMFocusOut orDOMFocusIn event is dispatched.

Note: For stand-alone SVG documents, the user agent must always have a currently focused object. At the beginning, theSVGDocument has focus.

Parameters
inEventTargettheObjectThe object which should receive focus.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the in parameter is not aNode orSVGElementInstance, or if the requested element is not focusable (i.e. its'focusable' attribute indicates that the element is not focusable).
getCurrentFocusedObject
Returns a reference to the object which has the focus. This returns anEventTarget.
No parameters
Return value
EventTargetobjectThe currently focused object.
No exceptions

A.8.6SVGRGBColor

This interface represents a color value made up of red, green, and blue components. It can be used to read and write traits that store color values (usinggetRGBColorTrait) such as'fill','stroke', and'color'.
IDL Definition
interface SVGRGBColor{attribute unsigned long red;attribute unsigned long green;attribute unsigned long blue;};
No defined constants
Attributes
red
Returns the red component of theSVGRGBColor.
green
Returns the green component of theSVGRGBColor.
blue
Returns the blue component of theSVGRGBColor.
No defined methods

A.8.7SVGRect

This interface represents anSVGRectdatatype, consisting of a minimumx, minimumy, width and height values.

This interface is identical toSVGRect interface defined inSVG 1.1 ([SVG11], section 4.3).

IDL Definition
interface SVGRect{attribute float x;attribute float y;attribute float width;attribute float height;};
No defined constants
Attributes
x
Seex.
y
Seey.
width
Seewidth.
height
Seeheight.
No defined methods

A.8.8SVGPoint

Represents anSVGPoint datatype,identified by itsx andy components.

This interface is identical toSVGPoint interface defined inSVG 1.1 ([SVG11], section 4.3).

IDL Definition
interface SVGPoint{attribute float x;attribute float y;SVGPoint matrixTransform(in SVGMatrix matrix);};
No defined constants
Attributes
x
Seex.
y
Seey.
Methods
matrixTransform
SeematrixTransform.

A.8.9SVGPath

This interface represents anSVGPath datatype usedto define path geometry.

Path data created or modified using this interface must be normalized as per the rules given inPath Normalization. However, path data that is just queried need not be normalized.

IDL Definition
interface SVGPath{const unsigned short MOVE_TO = 77;const unsigned short LINE_TO = 76;const unsigned short CURVE_TO = 67;const unsigned short QUAD_TO = 81;const unsigned short CLOSE = 90;readonly attribute unsigned long numberOfSegments;unsigned short getSegment(in unsigned long cmdIndex) raises(DOMException);float getSegmentParam(in unsigned long cmdIndex, in unsigned long paramIndex) raises(DOMException);void moveTo(in float x, in float y);void lineTo(in float x, in float y);void quadTo(in float x1, in float y1, in float x2, in float y2);void curveTo(in float x1, in float y1, in float x2, in float y2, in float x3, in float y3);void close();};
Constants
MOVE_TO
Represents a "move to" command. The numeric value is the Unicode codepoint of the letter "M".
LINE_TO
Represents a "line to" command. The numeric value is the Unicode codepoint of the letter "L".
CURVE_TO
Represents a "cubic Bézier curve to" command. The numeric value is the Unicode codepoint of the letter "C".
QUAD_TO
Represents a "quadrative Bézier curve to" command. The numeric value is the Unicode codepoint of the letter "Q".
CLOSE
Represents a "close" command. The numeric value is the Unicode codepoint of the letter "Z".
Attributes
numberOfSegments
Return number of segments in this path.
Methods
getSegment
Returns segment command by zero-based command index.
Parameters
inunsigned longcmdIndexThe command index for the segment command to retrieve.
Return value
unsigned shortThe segment command. One ofMOVE_TO,LINE_TO,CURVE_TO,QUAD_TO orCLOSE.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if the segment index is out of bounds.
getSegmentParam
Returns segment parameter by zero-based command index and zero-based parameter index.
Parameters
inunsigned longcmdIndexThe command index for the segment command.
inunsigned longparamIndexThe parameter index to retrieve.
Return value
floatThe segment parameter.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if the segment index is out of bounds, or the parameter index is out of bounds for the specified segment's type.
moveTo
Appends an 'M' (absolute move) segment to the path with the specified coordinates.
Parameters
infloatxThe x-axis coordinate for the specified point.
infloatyThe y-axis coordinate for the specified point.
No return value
No exceptions
lineTo
Appends an 'L' (absolute line) segment to the path with the specified coordinates.
Parameters
infloatxThe x-axis coordinate for the specified point.
infloatyThe y-axis coordinate for the specified point.
No return value
No exceptions
quadTo
Appends a 'Q' (absolute quadratic curve) segment to the path.
Parameters
infloatx1The x-axis coordinate of the first control point.
infloaty1The y-axis coordinate of the first control point.
infloatx2The x-axis coordinate of the final end point.
infloaty2The y-axis coordinate of the final end point.
No return value
No exceptions
curveTo
Appends a 'C' (absolute cubic curve) segment to the path.
Parameters
infloatx1The x-axis coordinate of the first control point.
infloaty1The y-axis coordinate of the first control point.
infloatx2The x-axis coordinate of the second end point.
infloaty2The y-axis coordinate of the second end point.
infloatx3The x-axis coordinate of the final end point.
infloaty3The y-axis coordinate of the final end point.
No return value
No exceptions
close
Appends a 'z' (close path) segment to the path.

A.8.10SVGMatrix

This interface is a matrix, as is used to represent an affine transform. It can be used to read and modify the values of the'transform' attribute.

Note: ThemTranslate,inverse,mMultiply,mScale andmRotate methods in this interface mutate theSVGMatrix object and return a reference to theSVGMatrix instance itself, after performing the necessary matrix operation.

This matrix transforms source coordinates (x, y) into destination coordinates (x', y') by considering them to be a column vector and multiplying the coordinate vector by the matrix according to the following process:

    [ x' ]    [  a  c  e  ]   [ x ]    [ a.x + c.y + e ]    [ y' ] =  [  b  d  f  ]   [ y ] =  [ b.x + d.y + f ]    [ 1  ]    [  0  0  1  ]   [ 1 ]    [        1      ]
IDL Definition
interface SVGMatrix{float getComponent(in unsigned long index) raises(DOMException);SVGMatrix mMultiply(in SVGMatrix secondMatrix);SVGMatrix inverse() raises(SVGException);SVGMatrix mTranslate(in float x, in float y);SVGMatrix mScale(in float scaleFactor);SVGMatrix mRotate(in float angle);};
No defined constants
No defined attributes
Methods
getComponent
Returns a component of the matrix by the component's zero-based index.getComponent(0) isa,getComponent(1) isb, etc.
Parameters
inunsigned longindexThe index of the matrix component to retrieve.
Return value
floatThe matrix component.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if theindex is invalid (i.e., outside the range [0, 5]).
mMultiply
Performs matrix multiplication. This matrix is post-multiplied by another matrix, returning the resulting current matrix.
Parameters
inSVGMatrixsecondMatrixThe matrix to post-multiply with.
Return value
SVGMatrixThe resulting current matrix.
No exceptions
inverse
Returns a new instance ofSVGMatrix containing the inverse of the current matrix.
No parameters
Return value
SVGMatrixThe inverse of the current matrix.
Exceptions
SVGException
SVG_MATRIX_NOT_INVERTABLE: Raised when the determinant of this matrix is zero.
mTranslate
Post-multiplies a translation transformation on the current matrix and returns the resulting current matrix. This is equivalent to callingmMultiply(T), whereT is anSVGMatrix object represented by the following matrix:
        [   1    0    x  ]        [   0    1    y  ]        [   0    0    1  ]
Parameters
infloatxThe distance by which coordinates are translated in thex-axis direction.
infloatyThe distance by which coordinates are translated in they-axis direction.
Return value
SVGMatrixThe resulting current matrix.
No exceptions
mScale
Post-multiplies a uniform scale transformation on the current matrix and returns the resulting current matrix. This is equivalent to callingmMultiply(S), whereS is anSVGMatrix object represented by the following matrix:
        [   scaleFactor      0          0   ]        [   0          scaleFactor      0   ]        [   0                0          1   ]
Parameters
infloatscaleFactorThe factor by which coordinates are scaled along thex- andy-axis.
Return value
SVGMatrixThe resulting current matrix.
No exceptions
mRotate
Post-multiplies a rotation transformation on the current matrix and returns the resulting current matrix. This is equivalent to callingmMultiply(R), whereR is anSVGMatrix object represented by the following matrix:
    [ cos(angle) -sin(angle) 0 ]    [ sin(angle)  cos(angle) 0 ]    [ 0           0          1 ]
Parameters
infloatangleThe angle of rotation in degrees.
Return value
SVGMatrixThe resulting current matrix.
No exceptions

A.8.11SVGLocatable

Interface for getting information about the location of elements.
IDL Definition
interface SVGLocatable{SVGRect   getBBox();SVGMatrix getScreenCTM();SVGRect   getScreenBBox();};
No defined constants
No defined attributes
Methods
getBBox
Returns thebounding box of the element.
No parameters
Return value
SVGRectThebounding box. The returned object is a copy of the current bounding box value and will not change if the corresponding bounding box changes.
No exceptions
getScreenCTM
Returns the transformation matrix from current user units to theinitial viewport coordinate system. TheclientX andclientY coordinates of aMouseEvent are in the initial viewport coordinate system. Note thatnull is returned if this element is not hooked into the document tree. This method would have been more aptly named asgetClientCTM, but the namegetScreenCTM is kept for historical reasons. Also note thatgetScreenCTM reflects a snapshot of the current animated state, i.e. if one or several transforms that affect the element thatgetScreenCTM is called upon are animated then the returned transformation matrix reflects the current state of each such animated transform when calculating the returned matrix.
No parameters
Return value
SVGMatrixThe transformation matrix. The returned object is a copy of the current screen CTM value and will not change if the corresponding screen CTM changes.
No exceptions
getScreenBBox
Returns thebounding box of the element in screen coordinate space. The box coordinates are in theinitial viewport coordinate system, which is connected to the current user coordinate space by the matrix returned by theSVGLocatable::getScreenCTM method.
No parameters
Return value
SVGRectThebounding box in screen coordinate space. The returned object is a copy of the current screen bounding box value and will not change if the corresponding screen bounding box changes.
No exceptions

The following examples further clarify the behavior of thegetBBox()method. The examples have a short explanation, an SVG fragment and arefollowed by a set of bounding box values which have the followingformat:

[elementId] : {x, y, width, height} | {null}

wherex,y,width andheight define the values of theSVGRect objectsreturned from agetBBox call on the element with the specified ID.There are a few cases where the bounding box may benull (see example6).

Example #1: Simple groups and bounds
This first example shows the values returned by thegetBBox method for various simplebasic shapes and groups. In particular, it shows that the transform, on an element, does not change the value of its userspace bounding box.
<g xml:id="group1" transform="translate(10, 20)" fill="red">    <rect xml:id="rect1" transform="scale(2)" x="10" y="10" width="50" height="50"/>    <rect xml:id="rect2" x="10" y="10" width="100" height="100"/>    <g xml:id="group2" transform="translate(10, 20)">        <rect xml:id="rect3" x="0" y="10" width="150" height="50"/>        <circle xml:id="circle1" cx="20" cy="20" r="100" />    </g></g>

Result:
[group1] : {-70.0, -60.0, 230.0, 200.0}
[rect1] : {10.0, 10.0, 50.0, 50.0}
[rect2] : {10.0, 10.0, 100.0, 100.0}
[group2] : {-80.0, -80.0, 230.0, 200.0}
[rect3] : {0.0, 10.0, 150.0, 50.0}
[circle1] : {-80.0, -80.0, 200.0, 200.0}


Example #2: Bounding box on zero width or height rectangle
This example illustrates that the bounding box on elements is based on the element's geometry coordinates. For example, the bounding box on a zero-width rectangle is defined (see below), even though the rectangleis not rendered.
<g xml:id="group1" transform="translate(10, 20)" fill="red">    <rect xml:id="rect2" x="10" y="10" width="400" height="0"/>    <g xml:id="group2" transform="translate(10, 20)">        <rect xml:id="rect3" x="0" y="10" width="150" height="50"/>    </g></g>

Result:
[group1] : {10.0, 10.0, 400.0, 70.0}
[rect2] : {10.0, 10.0, 400.0, 0.0}
[group2] : {0.0, 10.0, 150.0, 50.0}
[rect3] : {0.0, 10.0, 150.0, 50.0}


Example #3: Bounding Box on zero radius ellipses.
This is another example of how bounding boxes are based on the element's geometry. Here, the bounding box of an ellipse with a zerox-axis radius is still defined, even though the ellipse is not rendered.
<svg xml:id="mySVG" version="1.2" baseProfile="tiny" width="10" height="20">    <g xml:id="group1" transform="translate(10, 20)" fill="red">        <rect xml:id="rect1" x="10" y="10" width="100" height="100"/>        <ellipse xml:id="ellipse1" cx="20" cy="20" rx="0" ry="70" />    </g></svg>

Result:
[mySVG] : {20.0, -30.0, 100.0, 160.0}
[group1] : {10.0, -50.0, 100.0, 160.0}
[rect1] : {10.0, 10.0, 100.0, 100.0}
[ellipse1] : {20.0, -50.0, 0.0, 140.0}


Example #4: Viewports do not clip bounding boxes
This example shows that no matter what the viewport is on therootmost 'svg' element, the bounding boxes, based on the geometry, are still defined. Here, even though therootmost 'svg' element has a zero width, the bounding boxes for the root itself and its children is precisely defined.
<svg xml:id="mySVG" version="1.2" baseProfile="tiny" width="0" height="50">    <g xml:id="group1" transform="translate(10, 20)" fill="red" >        <rect xml:id="rect1" x="10" y="10" width="50" height="50"/>        <g xml:id="group2" transform="translate(10, 20)">            <rect xml:id="rect2" x="0" y="10" width="150" height="0"/>            <circle xml:id="circle1" cx="20" cy="20" r="500"/>        </g>    </g></svg>

Result:
[mySVG] : {-460.0, -440.0, 1000.0, 1000.0}
[group1] : {-470.0, -460.0, 1000.0, 1000.0}
[rect1] : {10.0, 10.0, 50.0, 50.0}
[group2] : {-480.0, -480.0, 1000.0, 1000.0}
[rect2] : {0.0, 10.0, 150.0, 0.0}
[circle1] : {-480.0, -480.0, 1000.0, 1000.0}


Example #5: getBBox on <use>
This example shows that the bounding box for a'use' element accounts for the'x' and'y' attributes defined on the element, just like the'x' and'y' attributes impact the bounding box computation on a'rect' or on an'image' element.
<svg version="1.2" baseProfile="tiny">    <defs>        <rect xml:id="myRect" x="0" y="0" width="60" height="40"/>    </defs>    <use xml:id="myUse" xlink:href="#myRect" x="-30" y="-20"/></svg>

Result:
[myRect] : {0.0, 0.0, 60.0, 40.0}
[myUse] : {-30.0, -20.0, 60.0, 40.0}


Example #6: Empty group
This example shows that the bounding box for an empty group isnull. By the same token, the bounding box of a'path' with an emptySVGPath (i.e. one with no path commands, which may happen after creating a new'path' element with acreateElementNScall) is alsonull.
<g xml:id="emptyG"/>

Result:
[emptyG] : {null}


Example #7: Impact ofdisplay="none" andvisibility="hidden"
This example shows how the bounding box of children withdisplay="none" are not accounted for in the computation of their parent's bounding box. This reflects the definition of the'display' property and its impact on rendering and bounding box computation. The example also shows that elements with'visibility' set tohidden still contribute totheir parent's bounding box computation.
<g xml:id="g1">    <g xml:id="g1.1.display.none" display="none">        <rect xml:id="rect1" x="10" y="10" width="40" height="40"/>    </g>    <rect xml:id="rect2.visibility.hidden" visibility="hidden" x="30" y="60" width="10" height="20"/></g>

Result:
[g1] : {30.0, 60.0, 10.0, 20.0}
[g1.1.display.none] : {10.0, 10.0, 40.0, 40.0}
[rect1] : {10.0, 10.0, 40.0, 40.0}
[rect2.visibility.hidden] : {30.0, 60.0, 10.0, 20.0}


Example #8: Concatenating bounding boxes in the container's user space
This example shows how the concatenation and computation of boundingboxes for container element happens in the container's user space.
<g xml:id="g1">    <line xml:id="line1" x2="100" y2="100" transform="rotate(-45)"/></g>

Result:
[g1] : {0.0, 0.0, 141.42136, 0}
[line1] : {0.0, 0.0, 100.0, 100.0}


Example #9: No influence of stroke-width
This example illustrates that stroking has no impact on the computationof bounding boxes.
<g>    <line xml:id="thickLine" stroke-width="10" x2="100" y2="0"/></g>

Result:
[thickLine] : {0.0, 0.0, 100.0, 0.0}


Example #10: No influence of viewBox
This example illustrates that the viewBox has no impact on the computation of bounding boxes.
<svg xml:id="rootSvg" version="1.2" baseProfile="tiny" width="500" height="300" viewBox="0 0 200 100">    <rect x="-100" y="-200" width="500" height="100"/></svg>

Result:
[rootSVG] : {-100, -200, 500, 100}

Example #11: Impact of elements which are not in the rendering tree
This example illustrates that elements which are not in therendering tree have no impact on the computation of bounding boxes.
        <g xml:id="g1">          <linearGradient xml:id="MyGradient"/>            <stop offset="0.05" stop-color="#F60"/>            <stop offset="0.95" stop-color="#FF6"/>          </linearGradient>        </g>

Result:
[g1] : {null}

A.8.12SVGLocatableElement

This interface represents an element that has a physical location on the screen.

This interface is implemented by:'rect','circle','ellipse','line','path','use','image','text','textArea','tspan','svg','a','video','animation','switch','foreignObject','polygon','polyline' and'g'.

IDL Definition
interface SVGLocatableElement : SVGElement, SVGLocatable{};
No defined constants
No defined attributes
No defined methods

A.8.13TraitAccess

Trait manipulation interface. This interface is used to read and manipulate the value of "traits" associated with anSVGElement. Eachtrait corresponds to an attribute or property, which is parsed and understood by the element and in most cases animatable. Unlike attributes, each element has a well-defined set of traits and attempting to access an unsupported trait must throw an exception. Also, unlike attributes, traits are typed and their values are normalized; for instance path data specified on a'path' element is parsed and all path commands are converted to their absolute variants, and it is not possible to determine from the value of the trait if a path command was absolute or relative. When getting and setting trait values, an accessor of the correct type must be used or an exception will be thrown.

For a trait corresponding to a property, the computed value is used: if the value of a given property is not specified on that element, then for inherited properties the value on the parent is used. For non-inherited values, or on the root element, the initial value of the property is used.

For a trait corresponding to a non-property attribute, if the attribute is inherited (such as'xml:lang') the value of the parent is used. If the attribute is not inherited, or on the root element, thelacuna value for the attribute is used, if known. If not known (for example, for an unknown attribute, or a known attribute with no specified default),null is returned.

Note that when using theTraitAccess interface for getting traits on elements outside of the tree, for example on elements just created or removed, what values are returned is user agent dependent.

The trait getter methods (getTrait,getTraitNS,getFloatTrait, etc.) return base values (i.e., before animation is applied), and this is true for both static and animated content. Note however that if the attribute isinherited from an animated parent value, it will inherit the animated value. The trait presentation value getter methods (getPresentationTrait,getPresentationTraitNS,getFloatPresentationTrait, etc.) return either the current animated value if the given trait is currently being animated or the base value if the given trait is not currently being animated. Not all attributes are accessible by traits — see thetable of supported attributes for details.

Setting a trait value has the same effect as changing a corresponding attribute, but trait setters can operate on typed values. The value which is modified is always a base value. For inheritable traits corresponding to properties, the trait value can always be set toinherit (but querying the value will always return the actual inherited value as explained above).

Note about invalid/unsupported trait values: There are two situations where the various trait setter methods (such as thesetTrait,setFloatTrait andsetPathTrait methods) consider a value invalid and throw aDOMException with the INVALID_ACCESS_ERR code. The first situation is when the trait value is invalid with regards to its definition. (For example, trying to set the'stroke-linejoin' trait to'foo' would result in this exception being thrown). The trait methods will consider the value to be invalid if it is anunsupported value. However, if the trait value being set is anIRI reference, such as when setting a<FuncIRI> value on the'fill' property or when setting the'xlink:href' attribute on an'image' element, anSVG user agent must not consider that trait value invalid if it is syntactically correct but is otherwise aninvalid IRI reference. Thus, theDOMException with code INVALID_ACCESS_ERR must not be thrown in this case. This obviates the need for anSVG user agent to fetch theIRI upon setting the trait solely to determine whether it is aninvalid IRI reference.

The second situation is when the trait value is invalidwith regards to animations currently applied to the trait. The value isconsidered invalid because it would put the animation, and therefore thedocument, in an error state. For example, if a'path' element hasanimations on its'd' attribute, trying to change the'd' attribute to avalue incompatible with the animations will cause the exception to happen.

IDL Definition
interface TraitAccess{DOMString getTrait(in DOMString name) raises(DOMException);DOMString getTraitNS(in DOMString namespaceURI, in DOMString name) raises(DOMException);float getFloatTrait(in DOMString name) raises(DOMException);sequence<float> getFloatListTrait(in DOMString name) raises(DOMException);SVGMatrix getMatrixTrait(in DOMString name) raises(DOMException);SVGRect getRectTrait(in DOMString name) raises(DOMException);SVGPath getPathTrait(in DOMString name) raises(DOMException);SVGRGBColor getRGBColorTrait(in DOMString name) raises(DOMException);DOMString getPresentationTrait(in DOMString name) raises(DOMException);DOMString getPresentationTraitNS(in DOMString namespaceURI, in DOMString name) raises(DOMException);float getFloatPresentationTrait(in DOMString name) raises(DOMException);sequence<float> getFloatListPresentationTrait(in DOMString name) raises(DOMException);SVGMatrix getMatrixPresentationTrait(in DOMString name) raises(DOMException);SVGRect getRectPresentationTrait(in DOMString name) raises(DOMException);SVGPath getPathPresentationTrait(in DOMString name) raises(DOMException);SVGRGBColor getRGBColorPresentationTrait(in DOMString name) raises(DOMException);void setTrait(in DOMString name, in DOMString value) raises(DOMException);void setTraitNS(in DOMString namespaceURI, in DOMString name, in DOMString value) raises(DOMException);void setFloatTrait(in DOMString name, in float value) raises(DOMException);void setFloatListTrait(in DOMString name, in sequence<float> value) raises(DOMException);void setMatrixTrait(in DOMString name, in SVGMatrix matrix) raises(DOMException);void setRectTrait(in DOMString name, in SVGRect rect) raises(DOMException);void setPathTrait(in DOMString name, in SVGPath path) raises(DOMException);void setRGBColorTrait(in DOMString name, in SVGRGBColor color) raises(DOMException);};
No defined constants
No defined attributes
Methods
getTrait
Returns the trait value (possiblynormalized) as aDOMString. In SVG Tiny only certain traits can be obtained as aDOMString value. Syntax of the returnedDOMString matches the syntax of the corresponding attribute. This method is exactly equivalent togetTraitNS withnamespaceURI set tonull.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
DOMStringThe trait value.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to aDOMString (SVG Tiny only).
getTraitNS
Same asgetTrait, but for namespaced traits. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnamespaceURIThe namespace of the trait to retrieve.
inDOMStringnameThe name of the trait to retrieve.
Return value
DOMStringThe trait value.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to aDOMString (SVG Tiny only).
getFloatTrait
Get the trait value as afloat. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
floatThe trait value as afloat.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value is a non-numericfloat (for example, when callinggetFloatTrait("width") on therootmost 'svg' element whose width attribute uses a percentage).
getFloatListTrait
Get the trait value as asequence<float>. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
sequence<float>The trait value as asequence<float>.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to asequence<float>.
getMatrixTrait
Returns the trait value as anSVGMatrix. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGMatrixThe trait value as anSVGMatrix.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGMatrix.
getRectTrait
Returns the trait value as anSVGRect. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.If the actual trait value is not anSVGRect, e.g. the'none' value on the'viewBox' attribute, this method will returnnull. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGRectThe trait value as anSVGRect.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGRect.
getPathTrait
Returns the trait value as anSVGPath. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGPathThe trait value as anSVGPath.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGPath.
getRGBColorTrait
Returns the trait value as anSVGRGBColor. The returned object is a copy of the trait value and will not change if the corresponding trait changes. If the actual trait value is not anSVGRGBColor, i.e.'none' or a link to a paint server (e.g. to a gradient or a'solidColor'), this method must returnnull.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGRGBColorThe trait value as anSVGRGBColor.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGRGBColor.
getPresentationTrait
Returnsthe trait presentation value as aDOMString. In SVG Tiny only certain traits can be obtained as aDOMString value. Syntax of the returnedDOMString matches the syntax of the corresponding attribute. This method is exactly equivalent togetPresentationTraitNS withnamespaceURI set tonull.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
DOMStringThe trait presentation value.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to aDOMString (SVG Tiny only).
getPresentationTraitNS
Same asgetPresentationTrait, but for namespaced traits. The parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnamespaceURIThe namespace of the trait to retrieve.
inDOMStringnameThe name of the trait to retrieve.
Return value
DOMStringThe trait presentation value.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to aDOMString (SVG Tiny only).
getFloatPresentationTrait
Get the trait presentation value as afloat. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
floatThe trait presentation value as afloat.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value is a non-numericfloat (for example, when callinggetFloatTrait("width") on therootmost 'svg' element whose width attribute uses a percentage).
getFloatListPresentationTrait
Get the trait presentation value as asequence<float>. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
sequence<float>The trait presentation value as asequence<float>.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to asequence<float>.
getMatrixPresentationTrait
Returns the trait presentation value as anSVGMatrix. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes or as animation continue to affect the trait presentation value.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGMatrixThe trait presentation value as anSVGMatrix.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGMatrix.
getRectPresentationTrait
Returns the trait presentation value as anSVGRect. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes or as animation continue to affect the trait presentation value.If the actual trait value is not anSVGRect, e.g. the'none' value on the'viewBox' attribute, this method will returnnull. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGRectThe trait presentation value as anSVGRect.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGRect.
getPathPresentationTrait
Returns the trait presentation value as anSVGPath. The returned object is a copy of the actual trait value and will not change if the corresponding trait changes or as animation continue to affect the trait presentation value.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGPathThe trait presentation value as anSVGPath.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGPath.
getRGBColorPresentationTrait
Returns the trait presentation value as anSVGRGBColor. The returned object is a copy of the trait value and will not change if the corresponding trait changes or as animation continue to affect the trait presentation value. If the actual trait value is not anSVGRGBColor, i.e.'none' or a link to a paint server (e.g. to a gradient or a'solidColor'), this method must returnnull.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to retrieve.
Return value
SVGRGBColorThe trait presentation value as anSVGRGBColor.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element ornull.
DOMException
TYPE_MISMATCH_ERR: Raised if requested trait's computed value cannot be converted to anSVGRGBColor.
setTrait
Set the trait value as aDOMString. In SVG Tiny only certain traits can be set through aDOMString value. The syntax of theDOMString that should be given as a value must be the same as syntax of the corresponding XML attribute value. Exactly equivalent tosetTraitNS with thenamespaceURI attribute set tonull.
Parameters
inDOMStringnameThe name of the trait to be set.
inDOMStringvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as aDOMString.
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if attempt is made to change a readonly trait.
setTraitNS
Same assetTrait, but for namespaced traits. The parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnamespaceURIThe namespace of the trait to be set.
inDOMStringnameThe name of the trait to be set.
inDOMStringvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as aDOMString.
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified.
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if attempt is made to change a readonly trait.
setFloatTrait
Set the trait value as afloat. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
infloatvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as a numericfloat (e.g.NaN).
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified.
setFloatListTrait
Set the trait value as asequence<float>. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
insequence<float>valueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as asequence<float>).
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified.
setMatrixTrait
Set the trait value as anSVGMatrix. Values inSVGMatrix are copied in the trait so subsequent changes to the givenSVGMatrix have no effect on the value of the trait.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
inSVGMatrixvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as anSVGMatrix.
DOMException
INVALID_ACCESS_ERR: Raised if the input value isnull.
setRectTrait
Set the trait value as anSVGRect. Values inSVGRect are copied in the trait so subsequent changes to the givenSVGRect have no effect on the value of the trait. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
inSVGRectvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as anSVGRect.
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified. AnSVGRect is invalid if the width or height values are set to negative.
setPathTrait
Set the trait value as anSVGPath. Values inSVGPath are copied in the trait so subsequent changes to the givenSVGPath have no effect on the value of the trait. Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
inSVGPathvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as anSVGPath.
DOMException
INVALID_ACCESS_ERR: Raised if the input value is an invalid value for the given trait ornull is specified. AnSVGPath is invalid if it begins with any segment other than MOVE_TO segment.
Note: An emptySVGPath is still a valid value.
setRGBColorTrait
Set the trait value as anSVGRGBColor. Values inSVGRGBColor are copied in the trait so subsequent changes to the givenSVGRGBColor have no effect on the value of the trait.Parameter name must be a non-qualified trait name, i.e. without prefix.
Parameters
inDOMStringnameThe name of the trait to be set.
inSVGRGBColorvalueThe value of the trait.
No return value
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the requested trait is not supported on this element.
DOMException
TYPE_MISMATCH_ERR: Raised if the requested trait's value cannot be specified as anSVGRGBColor.
DOMException
INVALID_ACCESS_ERR: Raised if the input value isnull.

Traits supported in this specification, SVG Tiny 1.2 uDOM

Trait access is not required on all of theSVG Tiny 1.2 attributes and properties. The table below showsthe attributes and properties that SVG Tiny 1.2 uDOM implementations must support trait access to.Each attribute row lists the allowed getters and setters. The "Lacuna Value" column specifies thelacuna value that must be used for each attribute or property. If a "Lacuna Value" column entry is empty, there is nolacuna value. Unless explicitly stated in the "Comments" column, a supported attribute is accessible on all elements it can belong to. See theattribute table for a list ofattributes and which elements they belong to.

Implementations that support multiple versions of SVG mustallow trait access to the most extensive set and support the typessupported by each trait in the most extensive set. However, content relying ontraits or trait types available in future versions may not work in allconformant SVG Tiny 1.2 uDOM implementations.

The user agent must raise a NOT_SUPPORTED_ERR whenever there is an attempt to use trait methods for traits which are not supported by the user agent.

For some of the attributes and data typesadditional rules apply. These rules are defined below the table.

Note: In the table below:

  • Wherever the table indicates that a user agent must support thegetTrait method, it must also support thegetTraitNS,getPresentationTrait, andgetPresentationTraitNS methods.
  • Wherever the table indicates that a user agent must support thegetTraitNS method, it must also support thegetPresentationTraitNS method.
  • Wherever the table indicates that a user agent must support one of the typed (i.e., non-string) trait getter methods (e.g.,getFloatTrait), it must also support the corresponding trait presentation getter method (e.g.,getFloatPresentationTrait).
  • Wherever the table indicates that a user agent must support thesetTrait method, it must also support thesetTraitNS method.
  • Traits can only be used for accessing attribute and property values. Theycannot be used for accessing font descriptors.
Trait TargetTrait Getter
[Return Value]
Trait Setter
[Argument Value]
Lacuna ValueComments
Element text contentgetTrait("#text")
[The element text content]
setTrait("#text", ...)
[New element text content]
SeeText Content Access.
accumulate, attributegetTrait("accumulate")
[none | sum]
setTrait("accumulate", ...)
[none | sum]
"none"
additive, attributegetTrait("additive")
[replace | sum]
setTrait("additive", ...)
[replace | sum]
"replace"
attributeName, attributegetTrait("attributeName")setTrait("attributeName", ...)
audio-level, propertygetFloatTrait("audio-level")
[0 ≤value ≤ 1]
setFloatTrait("audio-level", ...)
[0 ≤value ≤ 1]

setTrait("audio-level", ...)
[inherit]
1.0
baseProfile, attributegetTrait("baseProfile")setTrait("baseProfile", ...)"none"
begin, attributeN/AsetTrait("begin", ...)
calcMode, attributegetTrait("calcMode")
[discrete | linear | paced | spline]
setTrait("calcMode", ...)
[discrete | linear | paced | spline]
"paced" when accessed on an'animateMotion' element,"linear" otherwise
color, propertygetRGBColorTrait("color")setRGBColorTrait("color, ...")
setTrait("color", ...)
[inherit |<color>]
rgb(0,0,0)
cx, attributegetFloatTrait("cx")setFloatTrait("cx", ...)0.5 when accessed on a'radialGradient' element, 0.0 otherwise
cy, attributegetFloatTrait("cy")setFloatTrait("cy", ...)0.5 when accessed on a'radialGradient' element, 0.0 otherwise
d, attributegetPathTrait("d")setPathTrait("d", ...)AnSVGPath object with no path segmentsSeeAccessing rules for path attributes.
display, propertygetTrait("display")
[inline | none]
setTrait("display", ...)
[inline | none | inherit]
"inline"SeeAccessing rules for'display' property.
dur, attributeN/AsetTrait("dur", ...)
editable, attributegetTrait("editable")
[simple | none]
setTrait("editable, ...)
[simple | none]
"none"
end, attributeN/AsetTrait("end", ...)
fill, propertygetRGBColorTrait("fill")
getTrait("fill")
setRGBColorTrait("fill", ...)
setTrait("fill", ...)
[none | currentColor |<FuncIRI> |<color> |<system paint> | inherit]
rgb(0,0,0)There are no trait accessors for the animation element'fill' attribute.
fill-opacity, propertygetFloatTrait("fill-opacity")
[0 ≤value ≤ 1]
setFloatTrait("fill-opacity", ...)
[0 ≤value ≤ 1]

setTrait("fill-opacity", ...)
[inherit]
1.0
fill-rule, propertygetTrait("fill-rule")
[nonzero | evenodd]
setTrait("fill-rule", ...)
[nonzero | evenodd | inherit]
"nonzero"
focusable, attributegetTrait("focusable")
[true | false]
setTrait("focusable", ...)
[true | false | auto]
"auto"
focusHighlight, attributegetTrait("focusHighlight")
[auto | none]
setTrait("focusHighlight", ...)
[auto | none]
"auto"
font-family, propertygetTrait("font-family")setTrait("font-family", ...)User agent specificSeeAccessing rules for font properties.
font-size, propertygetFloatTrait("font-size")
[value ≥ 0]
setFloatTrait("font-size", ...)
[value ≥ 0]

setTrait("font-size", ...)
[xx-small | x-small | small | medium | large | x-large | xx-large | larger | smaller | inherit]
User agent specific
font-style, propertygetTrait("font-style")
[normal | italic | oblique]
setTrait("font-style", ...)
[normal | italic | oblique | inherit]
"normal"SeeAccessing rules for font properties.
font-weight, propertygetTrait("font-weight")
[100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]
setTrait("font-weight", ...)
[normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit]
"normal"SeeAccessing rules for font properties.
from, attributeN/AsetTrait("from", ...)
gradientUnits, attributegetTrait("gradientUnits")
[userSpaceOnUse | objectBoundingBox]
setTrait("gradientUnits", ...)
[userSpaceOnUse | objectBoundingBox]
"objectBoundingBox"
height, attributegetFloatTrait("height")
[value ≥ 0]

getTrait("height")
["auto"]
setFloatTrait("height", ...)
[value ≥ 0]

setTrait("height", ...)
["auto"]
"auto" when accessed on a'textArea' element, 0.0 otherwiseSeeAccessing rules for'width' and'height' attributes.
id, attributegetTrait("id")setTrait("id", ...)
keyPoints, attributeN/AsetTrait("keyPoints", ...)
keySplines, attributeN/AsetTrait("keySplines", ...)
keyTimes, attributeN/AsetTrait("keyTimes", ...)
max, attributeN/AsetTrait("max", ...)
min, attributeN/AsetTrait("min", ...)
nav-right, attributegetTrait("nav-right")
[auto | self |<FuncIRI>]
setTrait("nav-right", ...)
[auto | self |<FuncIRI>]
"auto"
nav-next, attributegetTrait("nav-next")
[auto | self |<FuncIRI>]
setTrait("nav-next", ...)
[auto | self |<FuncIRI>]
"auto"
nav-up, attributegetTrait("nav-up")
[auto | self |<FuncIRI>]
setTrait("nav-up", ...)
[auto | self |<FuncIRI>]
"auto"
nav-up-right, attributegetTrait("nav-up-right")
[auto | self |<FuncIRI>]
setTrait("nav-up-right", ...)
[auto | self |<FuncIRI>]
"auto"
nav-up-left, attributegetTrait("nav-up-left")
[auto | self |<FuncIRI>]
setTrait("nav-up-left", ...)
[auto | self |<FuncIRI>]
"auto"
nav-prev, attributegetTrait("nav-prev")
[auto | self |<FuncIRI>]
setTrait("nav-prev", ...)
[auto | self |<FuncIRI>]
"auto"
nav-down, attributegetTrait("nav-down")
[auto | self |<FuncIRI>]
setTrait("nav-down", ...)
[auto | self |<FuncIRI>]
"auto"
nav-down-right, attributegetTrait("nav-down-right")
[auto | self |<FuncIRI>]
setTrait("nav-down-right", ...)
[auto | self |<FuncIRI>]
"auto"
nav-down-left, attributegetTrait("nav-down-left")
[auto | self |<FuncIRI>]
setTrait("nav-down-left", ...)
[auto | self |<FuncIRI>]
"auto"
nav-left, attributegetTrait("nav-left")
[auto | self |<FuncIRI>]
setTrait("nav-left", ...)
[auto | self |<FuncIRI>]
"auto"
offset, attributegetFloatTrait("offset")
[0 ≤value ≤ 1]
setFloatTrait("offset", ...)
[0 ≤value ≤ 1]
0.0
opacity, propertygetFloatTrait("opacity")
[0 ≤value ≤ 1]
setFloatTrait("opacity", ...)
[0 ≤value ≤ 1]

setTrait("opacity", ...)
[inherit]
1.0
path, attributegetPathTrait("path")setPathTrait("path", ...)AnSVGPath object with no path segmentsSeeAccessing rules for path attributes.
points, attributegetFloatListTrait("points")setFloatListTrait("points", ...)
r, attributegetFloatTrait("r")
[value ≥ 0]
setFloatTrait("r", ...)
[value ≥ 0]
0.5 when accessed on a'radialGradient' element, 0.0 otherwise
repeatCount, attributeN/AsetTrait("repeatCount", ...)
repeatDur, attributeN/AsetTrait("repeatDur", ...)
restart, attributegetTrait("restart")
[always | whenNotActive | never]
setTrait("restart", ...)
[always | whenNotActive | never]
"always"
rx, attributegetFloatTrait("rx")
[value ≥ 0]
setFloatTrait("rx", ...)
[value ≥ 0]
0.0
ry, attributegetFloatTrait("ry")
[value ≥ 0]
setFloatTrait("ry", ...)
[value ≥ 0]
0.0
snapshotTime, attributegetFloatTrait("snapshotTime")
[value ≥ 0]
setFloatTrait("snapshotTime", ...)
[value ≥ 0]
0.0
solid-color, propertygetRGBColorTrait("solid-color")setRGBColorTrait("solid-color", ...)
setTrait("solid-color", ...)
[<color> | inherit]
rgb(0,0,0)
solid-opacity, propertygetFloatTrait("solid-opacity")
[0 ≤value ≤ 1]
setFloatTrait("solid-opacity", ...)
[0 ≤value ≤ 1]

setTrait("solid-opacity")
[inherit]
1.0
stop-color, propertygetRGBColorTrait("stop-color")
getTrait("stop-color")
[none |<color>]
setRGBColorTrait("stop-color", ...)
setTrait("stop-color")
[none | currentColor |<color> | inherit]
rgb(0,0,0)
stop-opacity, propertygetFloatTrait("stop-opacity")
[0 ≤value ≤ 1]
setFloatTrait("stop-opacity", ...)
[0 ≤value ≤ 1]

setTrait("stop-opacity", ...)
[inherit]
1.0
stroke, propertygetRGBColorTrait("stroke")
getTrait("stroke")
setRGBColorTrait("stroke", ...)
setTrait("stroke", ...)
[none | currentColor |<FuncIRI> |<color> |<system paint> | inherit]
"none"
stroke-dasharray, propertygetFloatListTrait("stroke-dasharray")
getTrait("stroke-dasharray")
[none, inherit]
setFloatListTrait("stroke-dasharray", ...)
setTrait("stroke-dasharray", ...)
[none, inherit]
"none"
stroke-dashoffset, propertygetFloatTrait("stroke-dashoffset")setFloatTrait("stroke-dashoffset", ...)

setTrait("stroke-dashoffset", ...)
[inherit]
0.0
stroke-linecap, propertygetTrait("stroke-linecap")
[butt | round | square]
setTrait("stroke-linecap", ...)
[butt | round | square | inherit]
"butt"
stroke-linejoin, propertygetTrait("stroke-linejoin")
[miter | round | bevel]
setTrait("stroke-linejoin", ...)
[miter | round | bevel | inherit]
"miter"
stroke-miterlimit, propertygetFloatTrait("stroke-miterlimit")
[value ≥ 1]
setFloatTrait("stroke-miterlimit")
[value ≥ 1]

setTrait("stroke-miterlimit", ...)
[inherit]
4.0
stroke-opacity, propertygetFloatTrait("stroke-opacity")
[0 ≤value ≤ 1]
setFloatTrait("stroke-opacity", ...)
[0 ≤value ≤ 1]

setTrait("stroke-opacity", ...)
[inherit]
1.0
stroke-width, propertygetFloatTrait("stroke-width")
[value ≥ 0]
setFloatTrait("stroke-width", ...)
[value ≥ 0]

setTrait("stroke-width", ...)
[inherit]
1.0
target, attributegetTrait("target")setTrait("target", ...)"_self"
text-anchor, propertygetTrait("text-anchor")
[start | middle | end]
setTrait("text-anchor", ...)
[start | middle | end | inherit]
"start"
to, attributeN/AsetTrait("to", ...)
transform, attributegetMatrixTrait("transform")
getTrait("transform")
setMatrixTrait("transform", ...)
setTrait("transform", ...)
Identity matrix (1,0,0,1,0,0)SeeAccessing rules for'transform' attribute.
type, attributegetTrait("type")
[translate | scale | rotate | skewX | skewY]
setTrait("type", ...)
[translate | scale | rotate | skewX | skewY]
These are the trait accessors for the'type'attribute on the'animateTransform' element.There are no trait accessors for the'type' attributeon the'audio','handler','image','script' and'video' elements.
values, attributeN/AsetTrait("values", ...)
vector-effect, propertygetTrait("vector-effect")
[none | non-scaling-stroke]
setTrait("vector-effect", ...)
[none | non-scaling-stroke | inherit]
"none"
version, attributegetTrait("version")setTrait("version", ...)User agent specific
viewBox, attributegetRectTrait("viewBox")
[null |SVGRect]
setRectTrait("viewBox", ...)
setTrait("viewBox", ...)
[none]
nullIf the'viewBox' attribute has the value'none',thegetRectTrait method will returnnull.
viewport-fill, propertygetRGBColorTrait("viewport-fill")
getTrait("viewport-fill")
[none |<color>]
setRGBColorTrait("viewport-fill", ...)
setTrait("viewport-fill", ...)
[none | currentColor |<color> | inherit]
"none"
viewport-fill-opacity, propertygetFloatTrait("viewport-fill-opacity")
[0 ≤value ≤ 1]
setFloatTrait("viewport-fill-opacity", ...)
[0 ≤value ≤ 1]

setTrait("viewport-fill-opacity", ...)
[inherit]
1.0
visibility, propertygetTrait("visibility")
[visible | hidden]
setTrait("visibility", ...)
[visible | hidden | inherit]
"visible"
width, attributegetFloatTrait("width")
[value ≥ 0]

getTrait("width")
["auto"]
setFloatTrait("width", ...)
[value ≥ 0]

setTrait("width", ...)
["auto" ]
"auto" when accessed on a'textArea' element, 0.0 otherwiseSeeAccessing rules for'width' and'height' attributes.
x, attributegetFloatTrait("x")

getFloatListTrait("x")
setFloatTrait("x", ...)

setFloatListTrait("x", ...)
0.0SeeAccessing rules for'x' and'y' attributes.
x1, attributegetFloatTrait("x1")setFloatTrait("x1", ...)0.0
x2, attributegetFloatTrait("x2")setFloatTrait("x2", ...)1.0 when accessed on a'linearGradient' element, 0.0 otherwise
xlink:href, attributegetTraitNS("http://www.w3.org/1999/xlink", "href")
[absolute IRI]
setTraitNS("http://www.w3.org/1999/xlink", "href", ...)""
y, attributegetFloatTrait("y")

getFloatListTrait("y")
setFloatTrait("y", ...)

setFloatListTrait("y", ...)
0.0SeeAccessing rules for'x' and'y' attributes.
y1, attributegetFloatTrait("y1")setFloatTrait("y1", ...)0.0
y2, attributegetFloatTrait("y2")setFloatTrait("y2", ...)0.0
zoomAndPan, attributegetTrait("zoomAndPan")
[disable | magnify]
setTrait("zoomAndPan", ...)
[disable | magnify]
"magnify"

A.8.14 Additional accessing rules

Accessing rules for'transform' attribute

The'transform' attribute in SVG Tiny 1.2 can have three types of values.The "normal" transformation list (e.g. scale, translate, rotate, matrix, etc.),the newly introduced'ref(svg)' type or'none'.getMatrixTrait returns the current evaluated matrix inall cases. If the user needs to know that the'transform' attribute value was a'ref' or a'none',getTrait must be used. By usingsetTrait the user can set the'transform' attribute to'ref(svg)' or'none'.

Accessing rules for'display' property

Due to backward compatibility reasons the'display' values accessible via the trait mechanism are limited to'none' and'inline', all other values are translated into'none' or'inline'. (For a list of all possible'display' values, seeControlling visibility.) If other'display' values are of interest, e.g. the user want to set display to'block', the more genericgetAttributeNS/setAttributeNS must be used. Note however that an SVG Tiny 1.2 user agent is allowed to normalize its attribute data as described inDisplay normalization.

Accessing rules for animation related elements

The following rule applies to SMIL animation elements ('animate','animateTransform','animateColor','animateMotion','set','discard').

These elements can be inserted and removed from the tree but they cannot be modified using theTraitAccess methods once inserted into the tree. If an attempt is made to do so, theTraitAccess method will throw aDOMException with code NOT_SUPPORTED_ERR. Modifying the element using thesetAttribute andsetAttributeNS methods of theElement interface will change the document, but will have no effect on the animation.

This restriction means that if the author wishes to add animations via script, the attributes of the animation elements must be modified before being inserted into the tree. The following is an example of adding an animation to the document, setting the relevant attributes prior to insertion.

Example: Animating via the uDOM
<svg version="1.2" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xml:id="svg-root"      width="100%" height="100%" viewBox="0 0 480 360">    <rect xml:id="myRect" fill="green" x="10" y="10" width="200" height="100" stroke="black" stroke-width="2"/></svg>
A script such as the following Java code might be used to add an animation to the rectangle:
SVGElement newAnimate = (SVGElement)document.createElementNS(svgNS, "animate");newAnimate.setTrait("attributeName", "fill");newAnimate.setTrait("from", "red");newAnimate.setTrait("to", "blue");newAnimate.setTrait("dur", "5");newAnimate.setTrait("repeatCount", "10");Element myRect = document.getElementById("myRect");myRect.appendChild(newAnimate);

Accessing rules for'x' and'y' attributes

IfgetFloatTrait is used to retrieve the value of the'x' or'y' attribute on a'text' element, where the attribute value has more than one<coordinate>, aDOMException with error code TYPE_MISMATCH_ERR must be raised. When the attribute value has only one coordinate, this is the value returned bygetFloatTrait.

IfgetFloatListTrait orsetFloatListTrait are used on elements other than a'text' element, aDOMException with error code TYPE_MISMATCH_ERR must be raised.

Accessing rules for'width' and'height' attributes

IfgetFloatTrait is used to retrieve the value of the'width' or'height' attribute on an'svg' element, where the value is specified as a percentage or unit value, aDOMException with error code TYPE_MISMATCH_ERR must be raised.

Accessing rules for font properties

If trait accessors are used to get or set the'font-family','font-style' or'font-weight' properties on a'font-face' element, aDOMException with error code NOT_SUPPORTED_ERR must be raised.

Accessing rules for path attributes

If the getPathTrait method is used to get anSVGPath and the path attribute was syntactically invalid at some point, the return value must be an SVGPath containing all valid path segments until the point of the error.

Accessing rules for multimedia elements

The following rule applies to multimedia elements ('audio','video','animation').

SVG timing attributes cannot be modified using theTraitAccess methods once inserted into the tree. If an attempt is made to do so, theTraitAccess method will throw aDOMException with code NOT_SUPPORTED_ERR. Modifying these attributes using thesetAttribute andsetAttributeNS methods of theElement interface will change the document, but will have no effect on the element.

A.8.15SVGElement

This interface represents anSVG element in the document tree.It provides methods to traverse elements in the uDOM tree and allows setting and getting the'id' of an element.

Note: See thedefinition of'id' and'xml:id' for the rules of how to treat'id' and'xml:id'.

IDL Definition
interface SVGElement : Element, EventTarget, TraitAccess{attribute DOMString id;};
No defined constants
Attributes
id

On read, returns the element's'xml:id' or'id' attribute according to the rules defined in theStructure chapter, ornull if no ID specified.

On write, sets the element's'xml:id' or'id' attributes according to the rules defined in theStructure chapter.

No defined methods

A.8.16SVGTimedElement

This interface represents anSVGTimedElement which is implemented bytimed elements and the'svg' element.
IDL Definition
interface SVGTimedElement : SVGElement, smil::ElementTimeControl{void pauseElement();void resumeElement();readonly attribute boolean isPaused;};
No defined constants
Attributes
isPaused
true if thetimed element is paused.false otherwise. SeePaused element and the active duration ([SMIL21], section 10.4.3). Note that an element that is stopped (has reached the end of its active duration) is not paused.
Methods
pauseElement
Pauses the timed element. SeePaused element and the active duration ([SMIL21], section 10.4.3).
No parameters
No return value
No exceptions
resumeElement
Resumes the timed element. SeePaused element and the active duration ([SMIL21], section 10.4.3).
No parameters
No return value
No exceptions

A.8.17SVGAnimationElement

This interface is implemented by the following SMIL animation elements:'animate','animateTransform','animateColor','animateMotion' and'set'. It is included for historical reasons and has been deprecated. Note that this interface is unrelated to the new'animation' element.

IDL Definition
interface SVGAnimationElement : SVGTimedElement{};
No defined constants
No defined attributes
No defined methods

A.8.18SVGVisualMediaElement

This interface represents a media element that is visual, i.e. has a physical location on the screen.It is implemented by:'animation' and'video'.
IDL Definition
interface SVGVisualMediaElement : SVGLocatableElement, SVGTimedElement{};
No defined constants
No defined attributes
No defined methods

A.8.19SVGTimer

TheSVGTimer interface provides an API for scheduling a one time or repetitive event. ASVGTimer object is always either in the running (attributerunning istrue) or waiting (attributerunning isfalse) state. After each interval of the timer, anEvent of typeSVGTimer is triggered.

SVGTimer events are triggered only when thetimer is in therunning state. TheSVGTimer event is limited to the target phase. SinceSVGTimer is anEventTarget,EventListeners can be registered on it usingaddEventListener withSVGTimer as the event type. Event listeners can access their corresponding SVGTimer object through the event object's target property.

SVGTimer instances are created using thecreateTimer method of theSVGGlobal interface.

IDL Definition
interface SVGTimer : events::EventTarget{attribute long delay;attribute long repeatInterval;readonly attribute boolean running;void start();void stop();};
No defined constants
Attributes
delay

This attribute specifies the time remaining in milliseconds until the next event is fired. When theSVGTimer is in therunning state this attribute is dynamically updated to reflect the remaining time in the current interval. When theSVGTimer iswaiting the delay reflects the time that remained when stopped. Getting the delay attribute returns the current value, i.e. a snapshot value of the remaining delay. After delay period has passed while the object is in therunning state, theSVGTimer object will trigger anEvent of typeSVGTimer. The delay will then be updated with therepeatInterval value and a new count down will start. Setting the delay resets the current interval to the new value. If this attribute is0, it means that the event will be triggered as soon as possible. Assigning a negative value is equivalent to calling thestop() method. The initial value is set through the initialInterval parameter in thecreateTimer method on theSVGGlobal interface, and defines the first interval of theSVGTimer.

repeatInterval

This attribute specifies in milliseconds the interval for each repeat of theSVGTimer, i.e. each timer interval subsequent to the initial interval. The initial value of this attribute is set through therepeatInterval parameter in thecreateTimer method on theSVGGlobal interface. Assigning a negative value disables the repetitive triggering of the event making it a one time timer which triggers an event after thedelay.

running

SVGTimer state. Value istrue if the timer is running,false if the timer is waiting. Note that therepeatInterval anddelay properties can be non-negative if the timer is stopped (but ifdelay is negative, the timer is stopped).

Methods
start

Changes theSVGTimer state intorunning. If the timer is already in the running state, it has no effect. Initially the timer iswaiting, and must be started with this method. If the timerdelay had a negative value when started, for example if the time had been stopped by setting the delay to a negative value, the delay value is reset torepeatInterval when the this method is called.

No parameters
No return value
No exceptions
stop

Changes theSVGTimer state intowaiting. If the timer is already in the waiting state, calling this method has no effect.

No parameters
No return value
No exceptions

A.8.20SVGGlobal

Many scripted SVG documents in existence make use of functions on a browser specific Window interface. SVG Tiny 1.2 specifies anSVGGlobal interface, on which some of these de facto standard functions are defined, as well as some functions for new features defines in this specification. TheSVGGlobal interface must be implemented by the object that represents thedefault view of the document ([DOM2VIEWS], section 1.1). This object also implementsAbstractView. Thus, in the ECMAScript language binding, the global script object implementsSVGGlobal. TheSVGGlobal object for a document can also be obtained throughDocumentView::defaultView.

IDL Definition
interface SVGGlobal{SVGTimer createTimer(in long initialInterval, in long repeatInterval);void getURL(in DOMString iri, in AsyncStatusCallback callback);void postURL(in DOMString iri, in DOMString data, in AsyncStatusCallback callback,              in DOMString type, in DOMString encoding);Node parseXML(in DOMString data, in Document contextDoc);};
No defined constants
No defined attributes
Methods
createTimer
Creates aSVGTimer with the provided initial and repeat Intervals. TheSVGTimer will initially be in thewaiting state.
Parameters
inlonginitialIntervalSpecifies the first interval in milliseconds for a repetitiveSVGTimer, i.e. sets the initial value of thedelay attribute on the timer. In the case theSVGTimer is not repetitive, it specifies the interval for the one time timer. Setting this parameter with a negative value will create anSVGTimer which is in the waiting state.
inlongrepeatIntervalSpecifies the time interval on which theSVGTimer repeats subsequent to the initial interval. A negative value will make theSVGTimer a one time timer.
Return value
SVGTimerThe createdSVGTimer.
No exceptions
getURL

Given anIRI and anAsyncStatusCallback object on which to call a callback function, this method will attempt to fetch the resource at that IRI. If the IRI uses the HTTP or HTTPS scheme, the HTTP GET method will be used. Implementations may support other schemes, but are not required to.

Processing requirements

This method call must take place asynchronously. When called, control returns immediately to the calling context, and once the request is completed the callback is called. Multiple calls to this method must be executed in FIFO order.

User agents are required to support the gzip content coding for HTTP requests and must decode such content before passing it on to the callback. User agents are not required to support gzip encoding content that they send, though they are encouraged to. Cookies should be supported so that state can be maintained across requests. User agents may provide the user with means to interact with the request (e.g. to enter authentication information) but are not required to.

It is important to note that for security reasons, user agents are strongly encouraged to restrict these requests by origin. When enforcing such restrictions, the callback is called immediately with itsAsyncURLStatus object'ssuccess field set tofalse and other fields set tonull. Redirection responses (3xx HTTP status codes) must not be exposed through the API but rather they must be processed internally according to the HTTP specification.

Parameters
inDOMStringiriTheIRI of the resource that is being requested.
inAsyncStatusCallbackcallbackThe object on which the callback will be called upon completion of the request.
No return value
No exceptions
postURL

Given anIRI, data to be transmitted, anAsyncStatusCallback object on which to call a callback function, a media type, and a content coding, this method will post the data to the specified IRI using the requested media type and content coding. User agents must supportpostURL being invoked with an HTTP or HTTPS IRI, but may support other IRI schemes if they indicate protocols that are functionally compatible with HTTP. Once the request has been completed the callback is invoked as described in theAsyncStatusCallback interface. IfpostURL is invoked with an IRI that does not support posting content, or which does not post content in a manner compatible with HTTP, aDOMException with code NOT_SUPPORTED_ERR must be thrown.

Processing requirements are the same as forgetURL, with the following notes and additions.

  • The data passed in does not get any HTML form encoding applied to it, so that applications that wish to transmit content corresponding to what an HTML form would must produce the encoding themselves
  • When the content type parameter is set then the Content-Type header of the request must be set accordingly. If the syntax of the content type parameter does not match that of a media type, it must be ignored. If this parameter is not specified, then it must default totext/plain.
  • When the encoding parameter is set then the user agent must encode the submitted data with that HTTP content coding and set the Content-Encoding header accordingly,if it supports it. If it does not support it, then it must ignore it, must not set the Content-Encoding header, and must transmit the data with no encoding. The only required content coding isidentity.
Parameters
inDOMStringiriTheIRI of the resource that is being requested.
inDOMStringdataThe data that will be the body of the POST request.
inAsyncStatusCallbackcallbackThe object on which the callback will be called upon completion of the request.
inDOMStringtypeThe content type of the POST request.
inDOMStringencodingThe encoding of the POST request.
No return value
No exceptions
parseXML

Given a string and aDocument object, parse the string as an XML document and return aNode representing it. If the XML in the string is not well-formed according to eitherXML 1.0 orXML 1.1 or not namespace-well-formed according toNamespaces in XML 1.0 orNamespaces in XML 1.1 respectively, this method must return anull value.

When parsing the input string, thecontextDoc parameter is used only for setting theownerDocument field in the parsed nodes.

If during parsing a'script' element is encountered, it must not be executed at that time. It will only be executed if it inserted into the current SVG document.

There is no requirement to load any external resources, e.g. external entities, stylesheets, scripts, raster images, video, audio, etc., for the parsing to complete. XSL stylesheets must not be applied.

If thecontextDoc parameter is defined, this method returns anElement object theownerDocument field of which must be set to be the providedDocument object. In effect when thecontextDoc parameter is specified the processing must be equivalent to applying the following steps:

  1. parsing the XML into aDocument
  2. retrieving itsdocumentElement element
  3. callingimportNode on theDocument object passed toparseXML with theElement from the previous step as its first parameter and thedeep parameter set totrue. (Please note thatimportNode is part of DOM 3 Core but not of the uDOM. It is mentioned here to indicate that the effect must be as ifimportNode had been used, but not to require that it be supported in implementations.)
  4. return the result of the last step
Parameters
inDOMStringdataThe data that is to be parsed as XML.
inDocumentcontextDocTheDocument object in the context of which to perform the parsing.
Return value
NodeANode (either aDocument or anElement) representing the content that was parsed.
Exceptions
DOMException
INVALID_CHARACTER_ERR: Raised if one of the parsed XML names is not an XML name according to the XML version of thecontextDoc document.

A.8.21AsyncStatusCallback

This interface is implemented by code that intends to process content retrieved throughgetURL orpostURL, both of which take an instance of this interface as a parameter. TheoperationComplete method of the object implementing this interface is called upon completion of the request.

IDL Definition
interface AsyncStatusCallback{void operationComplete(in AsyncURLStatus status);};
No defined constants
No defined attributes
Methods
operationComplete

This method is implemented by code in order to be notified of the result of fetching a resource usinggetURL orpostURL. Upon completion of the request, the method is called with anAsyncURLStatus object that holds the resource contents and information about the request.

Parameters
inAsyncURLStatusstatusAn object representing the HTTP response.
No return value
No exceptions

A.8.22AsyncURLStatus

This interface captures several aspects of an HTTP response in order to be passed to theoperationComplete method upon completion of an HTTP request.

IDL Definition
interface AsyncURLStatus{readonly attribute boolean success;readonly attribute DOMString contentType;readonly attribute DOMString content;};
No defined constants
Attributes
success

A boolean field indicating whether the request succeeded or not.

For HTTP requests with response status codes in the 200 range, this attribute must be set to true, and for status codes in the 400 and 500 ranges it must be set to false. Status codes in the 100 range must be ignored and those in the 300 range must be processed as indicated ingetURL's processing requirements.

When fetching non-HTTP resources, this attribute must be set to true if the resource was successfully retrieved in full, and false otherwise.

contentType

A string containing the media type of the response.

For HTTP requests, this attribute must be set to the value of the Content-Type HTTP header. If there was no Content-Type header, the attribute must be set tonull.

When fetching non-HTTP resources, this attribute must be set tonull.

content

A string containing the contents of the fetched resource.

If the resource is not a valid sequence of characters (as interpreted according to the media type and other headers for an HTTP request, or as appropriate for non-HTTP resources), then this attribute must be set to null.

For HTTP requests, if the media type of the response body was in thetext/* hierarchy and specified a charset parameter, then the text must be converted into the host programming language's native form if the encoding is supported. If the encoding is not supported, the value of this field must benull. The only required encodings are UTF-8 and UTF-16 (BE and LE). If the HTTP response body had one or more content codings applied to it then it must be fully decoded before setting this field. If the HTTP response status code was an error code but carried a body, the content of that body must still be exposed.

No defined methods

A.8.23EventListenerInitializer2

TheEventListenerInitializer2 interface is used to provide a way for scripts written in languages that do not have a concept of a "global object" to initialize their event listeners. Specifically, it is used for Java event listeners, but this general approach is suggested for other such scripting languages. See the description of the'script' element for details on how the object implementingEventListenerInitializer2 is discovered and used.

IDL Definition
interface EventListenerInitializer2{void initializeEventListeners(in Element scriptElement);EventListener createEventListener(in Element handlerElement);};
No defined constants
No defined attributes
Methods
initializeEventListeners

Invoked to indicate that the script given by the specified'script' element should be executed.

Parameters
inElementscriptElementThe'script' element that identifies the script to execute.
No return value
No exceptions
createEventListener

Invoked to obtain anEventListener that corresponds to the specified'handler' element.

Parameters
inElementhandlerElementThe'handler' element for which a correspondingEventListener is to be returned.
Return value
EventListener TheEventListener.
No exceptions

[8]ページ先頭

©2009-2025 Movatter.jp