Basic Data Types and Interfaces

Syntax

The EBNF grammar is as used in the XML specification, with the addition of ~, a case-insensitive literal: characters in the ASCII range (only) are declared to be case-insensitive. For example, ~"Hello" will match (H|h)(e|E)(l|L)(l|L)(o|O). This makes the productions much easier to read.

?optional, zero or one
+one or more
*zero or more
|alternation
"string"literal
~"string"case-insensitive literal
[]a character range
[^]excluded character range
()grouping

Basic data types

We should reference css3-values, and not redefine a bunch of types in this chapter.

This section defines a number of common data types used in the definitions of SVG properties and attributes. Some data types that are not referenced by multiple properties and attributes are defined inline in subsequent chapters.

Note that, as mentioned below, the specification of some types is different for CSS property values in style sheets (in the 'style attribute' attribute, 'style element' element or an external style sheet) than it is for for XML attribute values (including presentation attributes). This is due to restrictions in the CSS grammar. For example, scientific notation is allowed in attributes, including presentation attributes, but not in style sheets.

<anything>

The basic type <anything> is a sequence of zero or more characters. Specifically:

anything ::= Char*

where Char is the production for a character, as defined in XML 1.0 ([XML10], section 2.2).

<whitespace>

White space is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A), "form feed" (U+000C) and "carriage return" (U+000D).

wsp ::= ( #x9 | #x20 | #xA | #xC | #xD )
<child-selector>

A comma-separated list of compound selectors. When used, the scope in which the selectors are evaluated is also defined. Typically only the first matching element in tree order (as defined in [DOM4]) as a result of evaluating the list of selectors is used.

child-selector ::= select(compound selector#)
<color>

The basic type <color> is a CSS 2.1 compatible specification for a color in the sRGB color space [SRGB]. <color> applies to SVG's use of the 'color' property and is a component of the definitions of properties 'fill', 'stroke', 'stop-color', 'flood-color' and 'lighting-color', which also offer optional ICC-based color specifications.

SVG supports all of the syntax alternatives for <color> defined in CSS 2.1 syntax and basic data types ([CSS21], section 4.3.6), with the exception that SVG allows an expanded list of recognized color keywords names.

A <color> is either a keyword (see Recognized color keyword names) or a numerical RGB specification.

In addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. The normative definition of these keywords is found in System Colors ([CSS21], section 18.2).

The format of an RGB value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.

The format of an RGB value in the functional notation is an RGB start-function followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followed by ")". An RGB start-function is the case-insensitive string "rgb(", for example "RGB(" or "rGb(". For compatibility, the all-lowercase form "rgb(" is preferred.

The integer value 255 corresponds to 100%, and to F or FF in the hexadecimal notation: rgb(255,255,255) = rgb(100%,100%,100%) = #FFF. White space characters are allowed around the numerical values. All RGB colors are specified in the sRGB color space [SRGB]. Using sRGB provides an unambiguous and objectively measurable definition of the color, which can be related to international standards (see [COLORIMETRY]).

color    ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
             | "rgb(" wsp* integer comma integer comma integer wsp* ")"
             | "rgb(" wsp* integer "%" comma integer "%" comma integer "%" wsp* ")"
             | color-keyword
hexdigit ::= [0-9A-Fa-f]
comma    ::= wsp* "," wsp*
    

where color-keyword matches (case insensitively) one of the color keywords listed in Recognized color keyword names below, or one of the system color keywords listed in System Colors ([CSS21], section 18.2).

The corresponding SVG DOM interface definitions for <color> are defined in Document Object Model CSS; in particular, see RGBColor ([DOM2STYLE], section 2.2).

<frequency>

Frequency values are used with aural properties. As defined in CSS 2.1, a frequency value is a <number> immediately followed by a frequency unit identifier. The frequency unit identifiers are:

Frequency values may not be negative.

In the SVG DOM, <frequency> values are represented using the CSSPrimitiveValue interface defined in Document Object Model CSS ([DOM2STYLE], section 2.2).

<gradient>

A gradient as defined by CSS Level 3 Image Values [CSS3IMAGES] and can be used as paint server for the properties 'fill' and 'stroke'. Percentage values get resolved against the bounding box of the element to which the gradient is applied.

<icccolor>

An <icccolor> is an ICC color specification. In SVG 1.1, an ICC color specification is given by a name, which references an @color-profile rule, and one or more color component values. The grammar is as follows:

icccolor ::= "icc-color(" author-ident (comma-wsp number)+ ")"
<image>

An image source (including gradients) as defined by CSS Level 4 Image Values ([CSS4IMAGES], section 4.3).

<integer>

An <integer> is specified as an optional sign character ("+" or "-") followed by one or more digits "0" to "9", optionally surrounded by whitespace:

integer ::= wsp* [+-]? [0-9]+ wsp*

If the sign character is not present, the number is non-negative.

Unless stated otherwise for a particular attribute or property, the range for an <integer> encompasses (at a minimum) -2147483648 to 2147483647.

Within the SVG DOM, an <integer> is represented as a long or an SVGAnimatedInteger.

<languageID>
A language identifier specifies the language of text or other items in SVG. The syntax is given by [BCP47].
<length>

A length is a distance measurement, given as a number along with a unit which may be optional. Lengths are specified in one of two ways depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax:

In the SVG DOM, <length> values are represented using SVGLength or SVGAnimatedLength objects.

We should disentangle lengths and percentages.

<list-of-family-names>
A <list-of-family-names> is a list of font family names using the same syntax as the 'font-family' property, excluding the <generic-family> and 'inherit' values.
<list-of-strings>

A <list-of-strings> consists of a white space-separated sequence of <string>s.

The following is an EBNF grammar describing the <list-of-strings> syntax:

list-of-strings ::= string
                    | string wsp+ list-of-strings
string          ::= [^#x9#x20#xA#xC#xD]*
<list-of-Ts>

(Where T is a type other than <string> and <family-name>.) A list consists of a separated sequence of values. Unless explicitly described differently, lists within SVG's XML attributes can be either comma-separated, with optional white space before or after the comma, or white space-separated.

The following is a template for an EBNF grammar describing the <list-of-Ts> syntax:

list-of-Ts ::= T
               | T comma-wsp list-of-Ts
comma-wsp  ::= (wsp+ ","? wsp*) | ("," wsp*)

Within the SVG DOM, values of a <list-of-Ts> type are represented by an interface specific for the particular type T. For example, a <list-of-lengths> is represented in the SVG DOM using an SVGLengthList or SVGAnimatedLengthList object.

<number>

Real numbers are specified in one of two ways. When used in a style sheet, a <number> is defined as follows:

number ::= integer
           | [+-]? [0-9]* "." [0-9]+

This syntax is the same as the definition in CSS ([CSS21], section 4.3.1).

When used in an SVG attribute, a <number> is defined differently, to allow numbers with large magnitudes to be specified more concisely:

number ::= wsp* integer ([Ee] integer)?
           | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)? wsp*

Within the SVG DOM, a <number> is represented as a float, SVGNumber or a SVGAnimatedNumber.

<number-optional-number>

A pair of <number>s, where the second <number> is optional.

number-optional-number ::= wsp* number wsp*
                           | wsp* number comma-wsp number wsp*

In the SVG DOM, a <number-optional-number> is represented using a pair of SVGAnimatedInteger or SVGAnimatedNumber objects.

<paint>

The values for properties 'fill' and 'stroke' are specifications of the type of paint to use when filling or stroking a given graphics element. The available options and syntax for <paint> are described in Specifying paint.

<percentage>

Percentages are specified as a number followed by a "%" character:

percentage ::= wsp* number "%" wsp*

Note that the definition of <number> depends on whether the percentage is specified in a style sheet or in an attribute that is not also a presentation attribute.

Percentage values are always relative to another value, for example a length. Each attribute or property that allows percentages also defines the reference distance measurement to which the percentage refers.

Within the SVG DOM, a <percentage> is represented using an SVGNumber or SVGAnimatedNumber object.

<time>

A time value is a <number> immediately followed by a time unit identifier. The time unit identifiers are:

In the SVG DOM, <time> values are represented using the CSSPrimitiveValue interface defined in Document Object Model CSS ([DOM2STYLE], section 2.2).

<transform-list>

A <transform-list> is used to specify a list of coordinate system transformations. A detailed description of the possible values for a <transform-list> is given in Modifying the User Coordinate System: the transform property.

Within the SVG DOM, a <transform-list> value is represented using an SVGTransformList or SVGAnimatedTransformList object.

<url>

A Uniform Resource Locator (see URL). For the specification of URL references in SVG, see URL references.

<XML-Name>

An XML name, as defined by the Name production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3).

Real number precision

Unless stated otherwise for a particular attribute or property, a <number> has the capacity for at least a single-precision floating point number and has a range (at a minimum) of -3.4e+38F to +3.4e+38F.

It is recommended that higher precision floating point storage and computation be performed on operations such as coordinate system transformations to provide the best possible precision and to prevent round-off errors.

Conforming High-Quality SVG Viewers are required to use at least double-precision floating point for intermediate calculations on certain numerical operations.

Recognized color keyword names

The following is the list of recognized color keywords that can be used as a keyword value for data type <color>:

aliceblue rgb(240, 248, 255)
antiquewhite rgb(250, 235, 215)
aqua rgb( 0, 255, 255)
aquamarine rgb(127, 255, 212)
azure rgb(240, 255, 255)
beige rgb(245, 245, 220)
bisque rgb(255, 228, 196)
black rgb( 0, 0, 0)
blanchedalmond rgb(255, 235, 205)
blue rgb( 0, 0, 255)
blueviolet rgb(138, 43, 226)
brown rgb(165, 42, 42)
burlywood rgb(222, 184, 135)
cadetblue rgb( 95, 158, 160)
chartreuse rgb(127, 255, 0)
chocolate rgb(210, 105, 30)
coral rgb(255, 127, 80)
cornflowerblue rgb(100, 149, 237)
cornsilk rgb(255, 248, 220)
crimson rgb(220, 20, 60)
cyan rgb( 0, 255, 255)
darkblue rgb( 0, 0, 139)
darkcyan rgb( 0, 139, 139)
darkgoldenrod rgb(184, 134, 11)
darkgray rgb(169, 169, 169)
darkgreen rgb( 0, 100, 0)
darkgrey rgb(169, 169, 169)
darkkhaki rgb(189, 183, 107)
darkmagenta rgb(139, 0, 139)
darkolivegreen rgb( 85, 107, 47)
darkorange rgb(255, 140, 0)
darkorchid rgb(153, 50, 204)
darkred rgb(139, 0, 0)
darksalmon rgb(233, 150, 122)
darkseagreen rgb(143, 188, 143)
darkslateblue rgb( 72, 61, 139)
darkslategray rgb( 47, 79, 79)
darkslategrey rgb( 47, 79, 79)
darkturquoise rgb( 0, 206, 209)
darkviolet rgb(148, 0, 211)
deeppink rgb(255, 20, 147)
deepskyblue rgb( 0, 191, 255)
dimgray rgb(105, 105, 105)
dimgrey rgb(105, 105, 105)
dodgerblue rgb( 30, 144, 255)
firebrick rgb(178, 34, 34)
floralwhite rgb(255, 250, 240)
forestgreen rgb( 34, 139, 34)
fuchsia rgb(255, 0, 255)
gainsboro rgb(220, 220, 220)
ghostwhite rgb(248, 248, 255)
gold rgb(255, 215, 0)
goldenrod rgb(218, 165, 32)
gray rgb(128, 128, 128)
grey rgb(128, 128, 128)
green rgb( 0, 128, 0)
greenyellow rgb(173, 255, 47)
honeydew rgb(240, 255, 240)
hotpink rgb(255, 105, 180)
indianred rgb(205, 92, 92)
indigo rgb( 75, 0, 130)
ivory rgb(255, 255, 240)
khaki rgb(240, 230, 140)
lavender rgb(230, 230, 250)
lavenderblush rgb(255, 240, 245)
lawngreen rgb(124, 252, 0)
lemonchiffon rgb(255, 250, 205)
lightblue rgb(173, 216, 230)
lightcoral rgb(240, 128, 128)
lightcyan rgb(224, 255, 255)
lightgoldenrodyellow rgb(250, 250, 210)
lightgray rgb(211, 211, 211)
lightgreen rgb(144, 238, 144)
lightgrey rgb(211, 211, 211)
    
lightpink rgb(255, 182, 193)
lightsalmon rgb(255, 160, 122)
lightseagreen rgb( 32, 178, 170)
lightskyblue rgb(135, 206, 250)
lightslategray rgb(119, 136, 153)
lightslategrey rgb(119, 136, 153)
lightsteelblue rgb(176, 196, 222)
lightyellow rgb(255, 255, 224)
lime rgb( 0, 255, 0)
limegreen rgb( 50, 205, 50)
linen rgb(250, 240, 230)
magenta rgb(255, 0, 255)
maroon rgb(128, 0, 0)
mediumaquamarine rgb(102, 205, 170)
mediumblue rgb( 0, 0, 205)
mediumorchid rgb(186, 85, 211)
mediumpurple rgb(147, 112, 219)
mediumseagreen rgb( 60, 179, 113)
mediumslateblue rgb(123, 104, 238)
mediumspringgreen rgb( 0, 250, 154)
mediumturquoise rgb( 72, 209, 204)
mediumvioletred rgb(199, 21, 133)
midnightblue rgb( 25, 25, 112)
mintcream rgb(245, 255, 250)
mistyrose rgb(255, 228, 225)
moccasin rgb(255, 228, 181)
navajowhite rgb(255, 222, 173)
navy rgb( 0, 0, 128)
oldlace rgb(253, 245, 230)
olive rgb(128, 128, 0)
olivedrab rgb(107, 142, 35)
orange rgb(255, 165, 0)
orangered rgb(255, 69, 0)
orchid rgb(218, 112, 214)
palegoldenrod rgb(238, 232, 170)
palegreen rgb(152, 251, 152)
paleturquoise rgb(175, 238, 238)
palevioletred rgb(219, 112, 147)
papayawhip rgb(255, 239, 213)
peachpuff rgb(255, 218, 185)
peru rgb(205, 133, 63)
pink rgb(255, 192, 203)
plum rgb(221, 160, 221)
powderblue rgb(176, 224, 230)
purple rgb(128, 0, 128)
red rgb(255, 0, 0)
rosybrown rgb(188, 143, 143)
royalblue rgb( 65, 105, 225)
saddlebrown rgb(139, 69, 19)
salmon rgb(250, 128, 114)
sandybrown rgb(244, 164, 96)
seagreen rgb( 46, 139, 87)
seashell rgb(255, 245, 238)
sienna rgb(160, 82, 45)
silver rgb(192, 192, 192)
skyblue rgb(135, 206, 235)
slateblue rgb(106, 90, 205)
slategray rgb(112, 128, 144)
slategrey rgb(112, 128, 144)
snow rgb(255, 250, 250)
springgreen rgb( 0, 255, 127)
steelblue rgb( 70, 130, 180)
tan rgb(210, 180, 140)
teal rgb( 0, 128, 128)
thistle rgb(216, 191, 216)
tomato rgb(255, 99, 71)
turquoise rgb( 64, 224, 208)
violet rgb(238, 130, 238)
wheat rgb(245, 222, 179)
white rgb(255, 255, 255)
whitesmoke rgb(245, 245, 245)
yellow rgb(255, 255, 0)
yellowgreen rgb(154, 205, 50)
   

Basic DOM interfaces

SVG 2 Requirement: Make the SVGList* interfaces a bit more like other lists/arrays.
Resolution: Add array style indexing and .length and .item to svg list types.
Purpose: To align with other array types (e.g. NodeList). Already implemented in Opera and Firefox.
Owner: Erik (ACTION-2975)

Interface SVGElement

All of the SVG DOM interfaces that correspond directly to elements in the SVG language (such as the SVGPathElement interface for the 'path' element) derive from the SVGElement interface.

interface SVGElement : Element {
           attribute DOMString xmlbase;

  readonly attribute SVGAnimatedString className;
  readonly attribute CSSStyleDeclaration style;

  attribute DOMString xmllang;
  attribute DOMString xmlspace;

  readonly attribute SVGSVGElement? ownerSVGElement;
  readonly attribute SVGElement? viewportElement;
           attribute long tabIndex;
  void focus();
  void blur();        
};

SVGElement implements GlobalEventHandlers;
Attributes:
xmlbase (DOMString)
Corresponds to attribute 'xml:base' on the given element.
xmllang (DOMString)
Corresponds to attribute 'xml:lang' on the given element.
xmlspace (DOMString)
Corresponds to attribute 'xml:space' on the given element.
className (readonly SVGAnimatedString)
Corresponds to attribute 'class' on the given element.
style (readonly CSSStyleDeclaration)
Corresponds to attribute 'style attribute' on the given element. If the user agent does not support styling with CSS, then this attribute must always have the value of null.
ownerSVGElement (readonly SVGSVGElement)
The nearest ancestor 'svg' element. Null if the given element is the outermost svg element.
viewportElement (readonly SVGElement)
The element which established the current viewport. Often, the nearest ancestor 'svg' element. Null if the given element is the outermost svg element.
tabIndex (long)
The tabIndex attribute must reflect the value of the tabindex content attribute. Its default value is 0 for elements that are directly focusable, such as through keyboard tabbing in browsers that support that functionality, and −1 for elements that are not focusable without programmatic intervention.
Operations:
void focus()
Focuses the element.
void blur()
Unfocuses the element. Use of this method is discouraged. Focus another element instead.

Do not use this method to hide the focus ring. Do not use any other method that hides the focus ring from keyboard users,in particluar do not use a CSS rule to override the 'outline' property. Removal of the focus ring leads to serious accessibility issues for users who navigate and interact with interactive content using the keyboard.

Interface SVGAnimatedBoolean

Used for attributes of type boolean which can be animated.

interface SVGAnimatedBoolean {
           attribute boolean baseVal;
  readonly attribute boolean animVal;
};
Attributes:
baseVal (boolean)
The base value of the given attribute before applying any animations.
animVal (readonly boolean)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

Interface SVGAnimatedString

Used for attributes of type DOMString which can be animated.

interface SVGAnimatedString {
           attribute DOMString baseVal;
  readonly attribute DOMString animVal;
};
Attributes:
baseVal (DOMString)
The base value of the given attribute before applying any animations.
animVal (readonly DOMString)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

Interface SVGStringList

This interface defines a list of DOMString values.

SVGStringList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

The supported property indices of an SVGStringList object is all non-negative integers less than the length of the list.

interface SVGStringList {

  readonly attribute unsigned long length;
  readonly attribute unsigned long numberOfItems;

  void clear();
  DOMString initialize(DOMString newItem);
  getter DOMString getItem(unsigned long index);
  DOMString insertItemBefore(DOMString newItem, unsigned long index);
  DOMString replaceItem(DOMString newItem, unsigned long index);
  DOMString removeItem(unsigned long index);
  DOMString appendItem(DOMString newItem);
  setter void (unsigned long index, DOMString newItem);
};
Attributes:
length (readonly unsigned long)
The number of items in the list.
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString initialize(DOMString newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
Parameters
  1. DOMString newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString getItem(unsigned long index)
Returns the specified item from the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString insertItemBefore(DOMString newItem, unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0.
Parameters
  1. DOMString newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString replaceItem(DOMString newItem, unsigned long index)
Replaces an existing item in the list with a new item.
Parameters
  1. DOMString newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString removeItem(unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
DOMString appendItem(DOMString newItem)
Inserts a new item at the end of the list.
Parameters
  1. DOMString newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
setter void (unsigned long index, DOMString newItem)
Replaces the item at index index with newItem.

Interface SVGAnimatedEnumeration

Used for attributes whose value must be a constant from a particular enumeration and which can be animated.

interface SVGAnimatedEnumeration {
           attribute unsigned short baseVal;
  readonly attribute unsigned short animVal;
};
Attributes:
baseVal (unsigned short)
The base value of the given attribute before applying any animations.
animVal (readonly unsigned short)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

Interface SVGAnimatedInteger

Used for attributes of basic type <integer> which can be animated.

interface SVGAnimatedInteger {
           attribute long baseVal;
  readonly attribute long animVal;
};
Attributes:
baseVal (long)
The base value of the given attribute before applying any animations.
animVal (readonly long)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

Interface SVGNumber

Used for attributes of basic type <number>.

[Constructor,
 Constructor(float value)]
interface SVGNumber {
  attribute float value;
};
Constructors:
SVGNumber()
Creates a new SVGNumber object with its value attribute set to 0.
SVGNumber(float value)
Creates a new SVGNumber object with its value attribute set to value.
Attributes:
value (float)
The value of the given attribute.

Interface SVGAnimatedNumber

Used for attributes of basic type <number> which can be animated.

interface SVGAnimatedNumber {
           attribute float baseVal;
  readonly attribute float animVal;
};
Attributes:
baseVal (float)
The base value of the given attribute before applying any animations.
animVal (readonly float)
If the given attribute or property is being animated, contains the current animated value of the attribute or property. If the given attribute or property is not currently being animated, contains the same value as baseVal.

Interface SVGNumberList

This interface defines a list of SVGNumber objects.

SVGNumberList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

The supported property indices of an SVGNumberList object is all non-negative integers less than the length of the list.

An SVGNumberList object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGNumberList {

  readonly attribute unsigned long length;
  readonly attribute unsigned long numberOfItems;

  void clear();
  SVGNumber initialize(SVGNumber newItem);
  getter SVGNumber getItem(unsigned long index);
  SVGNumber insertItemBefore(SVGNumber newItem, unsigned long index);
  SVGNumber replaceItem(SVGNumber newItem, unsigned long index);
  SVGNumber removeItem(unsigned long index);
  SVGNumber appendItem(SVGNumber newItem);
  setter void (unsigned long index, SVGNumber newItem);
};
Attributes:
length (readonly unsigned long)
The number of items in the list.
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGNumber initialize(SVGNumber newItem)
Clears all existing current items from the list and re-initializes the list to hold a single item specified by the parameter. If newItem is in a list, then a new SVGNumber object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGNumber newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGNumber getItem(unsigned long index)
Returns the specified item from the list. The returned item is the item itself and not a copy. Any changes made to the item are immediately reflected in the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber insertItemBefore(SVGNumber newItem, unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, then a new SVGNumber object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGNumber replaceItem(SVGNumber newItem, unsigned long index)
Replaces an existing item in the list with a new item. If newItem is already in a list, then a new SVGNumber object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber removeItem(unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGNumber appendItem(SVGNumber newItem)
Inserts a new item at the end of the list. If newItem is already in a list, then a new SVGNumber object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGNumber newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
setter void (unsigned long index, SVGNumber newItem)
Replaces the item at index index with newItem. If the list is read only, then a NoModificationAllowedError is thrown.

Interface SVGAnimatedNumberList

Used for attributes which take a list of numbers and which can be animated.

interface SVGAnimatedNumberList {
  readonly attribute SVGNumberList baseVal;
  readonly attribute SVGNumberList animVal;
};
Attributes:
baseVal (readonly SVGNumberList)
The base value of the given attribute before applying any animations.
animVal (readonly SVGNumberList)
A read only SVGNumberList representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGNumberList will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

Interface SVGLength

The SVGLength interface corresponds to the <length> and <percentage> basic data types, and represents a length or percentage that consists of a numerical factor and a unit, where the unit is one of the set of units described in Units (em, ex, px, pt, pc, cm, mm and in), a percentage, a unitless number (user units), or "unknown".

An SVGLength object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

An SVGLength object can be associated with a particular element, as well as being designated with a directionality: horizontal, vertical or unspecified. The associated element and the directionality of the length are used to resolve percentage values to user units. Unless otherwise described, an SVGLength object is not associated with any element and has unspecified directionality.

We need to define the behavior of converting values from/to percentages when the viewport width/height/size is zero.

[Constructor,
 Constructor(float value, optional unsigned short unitType),
 Constructor(DOMString value)]
interface SVGLength {

  // Length Unit Types
  const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0;
  const unsigned short SVG_LENGTHTYPE_NUMBER = 1;
  const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2;
  const unsigned short SVG_LENGTHTYPE_EMS = 3;
  const unsigned short SVG_LENGTHTYPE_EXS = 4;
  const unsigned short SVG_LENGTHTYPE_PX = 5;
  const unsigned short SVG_LENGTHTYPE_CM = 6;
  const unsigned short SVG_LENGTHTYPE_MM = 7;
  const unsigned short SVG_LENGTHTYPE_IN = 8;
  const unsigned short SVG_LENGTHTYPE_PT = 9;
  const unsigned short SVG_LENGTHTYPE_PC = 10;

  readonly attribute unsigned short unitType;
           attribute float value;
           attribute float valueInSpecifiedUnits;
           attribute DOMString valueAsString;

  void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
  void convertToSpecifiedUnits(unsigned short unitType);
};
Constructors:
SVGLength()
Creates a new SVGLength object whose value is zero user units.
SVGLength(float value, optional unsigned short unitType)
Creates a new SVGLength object whose value is value in the units specified by unitType.
SVGLength(DOMString value)
Creates a new SVGLength object whose value is determined by parsing value as a <length> or <percentage>. If value cannot be parsed as a <length> or <percentage>, then a SyntaxError is thrown.
Constants in group “Length Unit Types”:
SVG_LENGTHTYPE_UNKNOWN (unsigned short)
The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_LENGTHTYPE_NUMBER (unsigned short)
No unit type was provided (i.e., a unitless value was specified), which indicates a value in user units.
SVG_LENGTHTYPE_PERCENTAGE (unsigned short)
A percentage value was specified.
SVG_LENGTHTYPE_EMS (unsigned short)
A value was specified using the em units defined in CSS 2.1.
SVG_LENGTHTYPE_EXS (unsigned short)
A value was specified using the ex units defined in CSS 2.1.
SVG_LENGTHTYPE_PX (unsigned short)
A value was specified using the px units defined in CSS 2.1.
SVG_LENGTHTYPE_CM (unsigned short)
A value was specified using the cm units defined in CSS 2.1.
SVG_LENGTHTYPE_MM (unsigned short)
A value was specified using the mm units defined in CSS 2.1.
SVG_LENGTHTYPE_IN (unsigned short)
A value was specified using the in units defined in CSS 2.1.
SVG_LENGTHTYPE_PT (unsigned short)
A value was specified using the pt units defined in CSS 2.1.
SVG_LENGTHTYPE_PC (unsigned short)
A value was specified using the pc units defined in CSS 2.1.
Attributes:
unitType (readonly unsigned short)
The type of the value as specified by one of the SVG_LENGTHTYPE_* constants defined on this interface.
value (float)
The value of the length in user units. On getting, returns the value converted to user units. If the type of the SVGLength is unknown, or it is a percentage but the object has no associated element, the numerical factor of the length is returned. On setting, sets the numerical factor to the assigned value and the unit type to user units.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length is read only.
valueInSpecifiedUnits (float)
The numerical factor of the length value.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length is read only.
valueAsString (DOMString)

The length value as a string. On getting, returns a string as follows:

  • If the unit type of the length is unknown or user units, the string is simply the numeric factor converted to a string.
  • If the unit type of the length is a percentage, the string is the result of concatenating the numeric factor converted to a string with the string "%".
  • Otherwise, the string is the result of concatenating the numeric factor converted to a string with the CSS length unit in lowercase.

On setting, updates the numeric factor and units type of the SVGLength object according to the result of parsing the assigned string as a <length> or <percentage>.

Exceptions on setting
DOMException, code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid <length> or <percentage>.
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length is read only.
Operations:
void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
Sets the numeric factor of the length value to valueInSpecifiedUnits and the unit type to unitType.
Parameters
  1. unsigned short unitType
    The unit type for the value (e.g., SVG_LENGTHTYPE_MM).
  2. float valueInSpecifiedUnits
    The new value.
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length is read only.
void convertToSpecifiedUnits(unsigned short unitType)

Sets the unit type of the length value to the type specified by unitType and sets the numeric factor value such that it represents the same absolute length. For example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then unitType would return SVG_LENGTHTYPE_MM and valueInSpecifiedUnits would return the numeric value 5.

If the old or new unit type is percentage and the SVGLength object has no associated element, then the percentages are considered to resolve against a length of 100 user units. For example, converting an SVGLength whose value is 20px to a percentage will result in the value being 20%.

Parameters
  1. unsigned short unitType
    The unit type to switch to (e.g., SVG_LENGTHTYPE_MM).
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the length is read only.

Interface SVGAnimatedLength

SVG 2 Requirement: Make it easier to read and write to attributes in the SVG DOM.
Resolution: We will make it easier to read and write to attributes in the SVG DOM in SVG2.
Purpose: To avoid the awkward access to the base values of SVGAnimatedLengths.
Owner: Cameron (ACTION-3414)

Used for attributes of basic type <length> which can be animated.

interface SVGAnimatedLength {
  readonly attribute SVGLength baseVal;
  readonly attribute SVGLength animVal;

           attribute float cm;
           attribute float em;
           attribute float ex;
           attribute float in;
           attribute float mm;
           attribute float pc;
           attribute float pt;
           attribute float px;
};

We should add accessors for the ch, rem, vw, vh, vmin and vmax units once we support css3-values more fully.

Since SVGAnimatedLength objects can represent percentage values too, what should we name the accessor for that unit?

Should we add a string accessor, perhaps named asString or value, to avoid having to write for example rect.x.baseVal.valueAsString?

Attributes:
baseVal (readonly SVGLength)
The base value of the given attribute before applying any animations.
animVal (readonly SVGLength)
A read only SVGLength representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGLength will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
cm (float)
On getting, returns the base value of the animated length in cm. On setting, changes the base value to be in cm and to have the specified magnitude.
em (float)
On getting, returns the base value of the animated length in em. On setting, changes the base value to be in em and to have the specified magnitude.
ex (float)
On getting, returns the base value of the animated length in ex. On setting, changes the base value to be in ex and to have the specified magnitude.
in (float)
On getting, returns the base value of the animated length in in. On setting, changes the base value to be in in and to have the specified magnitude.
mm (float)
On getting, returns the base value of the animated length in mm. On setting, changes the base value to be in mm and to have the specified magnitude.
pc (float)
On getting, returns the base value of the animated length in pc. On setting, changes the base value to be in pc and to have the specified magnitude.
pt (float)
On getting, returns the base value of the animated length in pt. On setting, changes the base value to be in pt and to have the specified magnitude.
px (float)
On getting, returns the base value of the animated length in px. On setting, changes the base value to be in px and to have the specified magnitude.

Interface SVGLengthList

This interface defines a list of SVGLength objects.

SVGLengthList has the same attributes and methods as other SVGxxxList interfaces. Implementers may consider using a single base class to implement the various SVGxxxList interfaces.

The supported property indices of an SVGLengthList object is all non-negative integers less than the length of the list.

An SVGLengthList object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

interface SVGLengthList {

  readonly attribute unsigned long length;
  readonly attribute unsigned long numberOfItems;

  void clear();
  SVGLength initialize(SVGLength newItem);
  getter SVGLength getItem(unsigned long index);
  SVGLength insertItemBefore(SVGLength newItem, unsigned long index);
  SVGLength replaceItem(SVGLength newItem, unsigned long index);
  SVGLength removeItem(unsigned long index);
  SVGLength appendItem(SVGLength newItem);
  setter void (unsigned long index, SVGLength newItem);
};
Attributes:
length (readonly unsigned long)
The number of items in the list.
numberOfItems (readonly unsigned long)
The number of items in the list.
Operations:
void clear()
Clears all existing current items from the list, with the result being an empty list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGLength initialize(SVGLength newItem)
Clears all existing current items from the list and re-initializes the list to hold a single item specified by the parameter. If newItem is in a list, then a new SVGLength object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGLength newItem
    The item which should become the only member of the list.
Returns
The item being inserted into the list.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGLength getItem(unsigned long index)
Returns the specified item from the list. The returned item is the item itself and not a copy. Any changes made to the item are immediately reflected in the list.
Parameters
  1. unsigned long index
    The index of the item from the list which is to be returned. The first item is number 0.
Returns
The selected item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGLength insertItemBefore(SVGLength newItem, unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, then a new SVGLength object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGLength newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item before which the new item is to be inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list. If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
SVGLength replaceItem(SVGLength newItem, unsigned long index)
Replaces an existing item in the list with a new item. If newItem is already in a list, then a new SVGLength object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGLength newItem
    The item which is to be inserted into the list.
  2. unsigned long index
    The index of the item which is to be replaced. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGLength removeItem(unsigned long index)
Removes an existing item from the list.
Parameters
  1. unsigned long index
    The index of the item which is to be removed. The first item is number 0.
Returns
The removed item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
DOMException, code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems.
SVGLength appendItem(SVGLength newItem)
Inserts a new item at the end of the list. If newItem is already in a list, then a new SVGLength object is created with the same values as newItem and this item is inserted into the list. Otherwise, newItem itself is inserted into the list.
Parameters
  1. SVGLength newItem
    The item which is to be inserted. The first item is number 0.
Returns
The inserted item.
Exceptions
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the list is read only.
setter void (unsigned long index, SVGLength newItem)
Replaces the item at index index with newItem. If the list is read only, then a NoModificationAllowedError is thrown.

Interface SVGAnimatedLengthList

Used for attributes of type SVGLengthList which can be animated.

interface SVGAnimatedLengthList {
  readonly attribute SVGLengthList baseVal;
  readonly attribute SVGLengthList animVal;

           attribute float cm;
           attribute float em;
           attribute float ex;
           attribute float in;
           attribute float mm;
           attribute float pc;
           attribute float pt;
           attribute float px;
};

If any changes to the unit accessors are made to SVGAnimatedLength they should be made here too.

Attributes:
baseVal (readonly SVGLengthList)
The base value of the given attribute before applying any animations.
animVal (readonly SVGLengthList)
A read only SVGLengthList representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGLengthList will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
cm (float)
On getting, returns the value of the first SVGLength of the animated length's base value in cm. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in cm and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given cm value.
em (float)
On getting, returns the value of the first SVGLength of the animated length's base value in em. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in em and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given em value.
ex (float)
On getting, returns the value of the first SVGLength of the animated length's base value in ex. If the base value list is expty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in ex and to have the specified magnitude. If the base value list is expty, it adds a new SVGLength object with the given ex value.
in (float)
On getting, returns the value of the first SVGLength of the animated length's base value in in. If the base value list is inpty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in in and to have the specified magnitude. If the base value list is inpty, it adds a new SVGLength object with the given in value.
mm (float)
On getting, returns the value of the first SVGLength of the animated length's base value in mm. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in mm and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given mm value.
pc (float)
On getting, returns the value of the first SVGLength of the animated length's base value in pc. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in pc and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given pc value.
pt (float)
On getting, returns the value of the first SVGLength of the animated length's base value in pt. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in pt and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given pt value.
px (float)
On getting, returns the value of the first SVGLength of the animated length's base value in px. If the base value list is empty, returns 0. On setting, changes the value of the animated length's first SVGLength value to be in px and to have the specified magnitude. If the base value list is empty, it adds a new SVGLength object with the given px value.

Interface SVGAngle

The SVGAngle interface corresponds to the <angle> basic data type, and represents an angle that consists of a numerical factor and a unit, where the unit is degrees, radians, grads, unitless numbers or "unknown".

An SVGAngle object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown, as described below.

[Constructor,
 Constructor(float value, optional unsigned short unitType),
 Constructor(DOMString value)]
interface SVGAngle {

  // Angle Unit Types
  const unsigned short SVG_ANGLETYPE_UNKNOWN = 0;
  const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1;
  const unsigned short SVG_ANGLETYPE_DEG = 2;
  const unsigned short SVG_ANGLETYPE_RAD = 3;
  const unsigned short SVG_ANGLETYPE_GRAD = 4;

  readonly attribute unsigned short unitType;
           attribute float value;
           attribute float valueInSpecifiedUnits;
           attribute DOMString valueAsString;

  void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
  void convertToSpecifiedUnits(unsigned short unitType);
};
Constructors:
SVGAngle()
Creates a new SVGAngle object whose value is zero user units.
SVGAngle(float value, optional unsigned short unitType)
Creates a new SVGAngle object whose value is value in the units specified by unitType.
SVGAngle(DOMString value)
Creates a new SVGAngle object whose value is determined by parsing value as an <angle>. If value cannot be parsed, then a SyntaxError is thrown.
Constants in group “Angle Unit Types”:
SVG_ANGLETYPE_UNKNOWN (unsigned short)
The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ANGLETYPE_UNSPECIFIED (unsigned short)
No unit type was provided (i.e., a unitless value was specified). For angles, a unitless value is treated the same as if degrees were specified.
SVG_ANGLETYPE_DEG (unsigned short)
The unit type was explicitly set to degrees.
SVG_ANGLETYPE_RAD (unsigned short)
The unit type is radians.
SVG_ANGLETYPE_GRAD (unsigned short)
The unit type is radians.
Attributes:
unitType (readonly unsigned short)
The type of the value as specified by one of the SVG_ANGLETYPE_* constants defined on this interface.
value (float)
The value of the angle in degrees. On getting, returns the value converted to degrees. If the type of the SVGAngle is unknown, the numerical factor of the angle is returned. On setting, sets the numerical factor to the assigned value and the unit type to unitless numbers.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle is read only.
valueInSpecifiedUnits (float)
The numerical factor of the angle value.
Exceptions on setting
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle is read only.
valueAsString (DOMString)

The angle value as a string. On getting, returns a string as follows:

  • If the unit type of the angle is unknown or unitless numbers, the string is simply the numeric factor converted to a string.
  • Otherwise, the string is the result of concatenating the numeric factor converted to a string with the CSS angle unit in lowercase.

On setting, updates the numeric factor and units type of the SVGAngle object according to the result of parsing the assigned string as an <angle>.

Exceptions on setting
DOMException, code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid <angle>.
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle is read only.
Operations:
void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
Sets the numeric factor of the angle value to valueInSpecifiedUnits and the unit type to unitType.
Parameters
  1. unsigned short unitType
    The unit type for the value (e.g., SVG_ANGLETYPE_DEG).
  2. float valueInSpecifiedUnits
    The new value.
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle is read only.
void convertToSpecifiedUnits(unsigned short unitType)

Sets the unit type of the angle value to the type specified by unitType and sets the numeric factor value such that it represents the same absolute angle. For example, if the original value were "180deg" and the method was invoked to convert to radians, then unitType would return SVG_ANGLETYPE_RAD and valueInSpecifiedUnits would return the numeric value π.

Parameters
  1. unsigned short unitType
    The unit type to switch to (e.g., SVG_ANGLETYPE_DEG).
Exceptions
DOMException, code NOT_SUPPORTED_ERR
Raised if unitType is SVG_ANGLETYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_ANGLETYPE_* constants defined on this interface).
DOMException, code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle is read only.

Interface SVGAnimatedAngle

Used for attributes of basic data type <angle> that can be animated.

interface SVGAnimatedAngle {
  readonly attribute SVGAngle baseVal;
  readonly attribute SVGAngle animVal;
};
Attributes:
baseVal (readonly SVGAngle)
The base value of the given attribute before applying any animations.
animVal (readonly SVGAngle)
A read only SVGAngle representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGAngle will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

Interface SVGAnimatedRect

Used for attributes of type DOMRect which can be animated.

interface SVGAnimatedRect {
  readonly attribute DOMRectReadOnly baseVal;
  readonly attribute DOMRectReadOnly animVal;
};
Attributes:
baseVal (readonly DOMRectReadOnly)
The base value of the given attribute before applying any animations.
animVal (readonly DOMRectReadOnly)
A read only DOMRectReadOnly representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the DOMRectReadOnly will have the same contents as baseVal. The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.

Interface SVGUnitTypes

The SVGUnitTypes interface defines a commonly used set of constants and is a base interface used by SVGGradientElement, SVGPatternElement, SVGClipPathElement, SVGMaskElement and SVGFilterElement.

[NoInterfaceObject]
interface SVGUnitTypes {
  // Unit Types
  const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;
  const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1;
  const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2;
};
Constants in group “Unit Types”:
SVG_UNIT_TYPE_UNKNOWN (unsigned short)
The type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_UNIT_TYPE_USERSPACEONUSE (unsigned short)
Corresponds to value 'userSpaceOnUse'.
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX (unsigned short)
Corresponds to value 'objectBoundingBox'.

Interface SVGGraphicsElement

SVG 2 Requirement: Detect if a mouse event is on the fill or stroke of a shape.
Resolution: SVG 2 will make it easier to detect if an mouse event is on the stroke or fill of an element.
Purpose: To allow authors to discriminate between pointer events on the fill and stroke of an element without having to duplicate the element
Owner: Cameron (ACTION-3279)

Interface SVGGraphicsElement represents SVG elements whose primary purpose is to directly render graphics into a group. The 'transform' property applies to all SVGGraphicsElement. All SVGGraphicsElement have a bounding box in current user space.

dictionary SVGBoundingBoxOptions {
  bool fill = true;
  bool stroke = false;
  bool markers = false;
  bool clipped = false;
};

interface SVGGraphicsElement : SVGElement {
  readonly attribute SVGAnimatedTransformList transform;

  readonly attribute SVGElement? nearestViewportElement;
  readonly attribute SVGElement? farthestViewportElement;

  DOMRect getBBox(optional SVGBoundingBoxOptions options);
  DOMMatrix? getCTM();
  DOMMatrix? getScreenCTM();
  DOMMatrix getTransformToElement(SVGGraphicsElement element);
};

SVGGraphicsElement implements SVGTests;
Attributes:
transform (readonly SVGAnimatedTransformList)
Corresponds to attribute 'transform' on the given element.

This needs to be updated to reflect the value of the 'transform' property.

nearestViewportElement (readonly SVGElement?)
The element which established the current viewport. Often, the nearest ancestor 'svg' element. Null if the current element is the outermost svg element.
farthestViewportElement (readonly SVGElement?)
The farthest ancestor 'svg' element. Null if the current element is the outermost svg element.
Operations:
DOMRect getBBox(optional SVGBoundingBoxOptions options)

Returns the result of invoking the bounding box algorithm for the element, with fill, stroke, markers and clipped members of the options dictionary argument used to control which parts of the element are included in the bounding box, using the element's user space as the coordinate system to return the bounding box in.

Returns
An DOMRect object that defines the bounding box.
DOMMatrix? getCTM()
Returns the transformation matrix from current user units (i.e., after application of the 'transform' property) to the viewport coordinate system for the nearestViewportElement. Note that null is returned if this element is not hooked into the document tree.
Returns
An DOMMatrix object that defines the CTM.
DOMMatrix? getScreenCTM()
Returns the transformation matrix from current user units (i.e., after application of the 'transform' property) to the parent user agent's notice of a "pixel". For display devices, ideally this represents a physical screen pixel. For other devices or environments where physical pixel sizes are not known, then an algorithm similar to the CSS 2.1 definition of a "pixel" can be used instead. Note that null is returned if this element is not hooked into the document tree. This method would have been more aptly named as getClientCTM, but the name getScreenCTM is kept for historical reasons.
Returns
An DOMMatrix object that defines the given transformation matrix.
DOMMatrix getTransformToElement(SVGGraphicsElement element)
Returns the transformation matrix from the user coordinate system on the current element (after application of the 'transform' property) to the user coordinate system on parameter element (after application of its 'transform' property).
Parameters
  1. SVGElement element
    The target element.
Returns
An DOMMatrix object that defines the transformation.
Exceptions
InvalidStateError
Raised if the currently defined transformation matrices make it impossible to compute the given matrix (e.g., because one of the transformations is singular).

Interface SVGGeometryElement

Interface SVGGeometryElement represents SVG elements whose rendering is defined by geometry and which can be filled and stroked. This includes paths, text and the basic shapes.

interface SVGGeometryElement : SVGGraphicsElement {
  bool isPointInFill(DOMPoint point);
  bool isPointInStroke(DOMPoint point);
};
Operations:
bool isPointInFill(DOMPoint point)
Returns whether the specified point is within the fill of the element. Normal hit testing rules apply; the value of the 'pointer-events' property on the element determines whether a point is considered to be within the fill.
Parameters
  1. DOMPoint point
    The point to check for intersection with the fill of this element. The DOMPoint is interpreted as a as a point in the user space of this element.
Returns
true if the point is within the fill of this shape, or false otherwise.
bool isPointInStroke(DOMPoint point)
Returns whether the specified point is within the stroke of the element. Normal hit testing rules apply; the value of the 'pointer-events' property on the element determines whether a point is considered to be within the stroke.
Parameters
  1. DOMPoint point
    The point to check for intersection with the stroke of this element. The DOMPoint is interpreted as a as a point in the user space of this element.
Returns
true if the point is within the stroke of this shape, or false otherwise.

Interface SVGTests

Interface SVGTests defines an interface which applies to all elements which have attributes 'requiredFeatures', 'requiredExtensions' and 'systemLanguage'.

[NoInterfaceObject]
interface SVGTests {

  readonly attribute SVGStringList requiredFeatures;
  readonly attribute SVGStringList requiredExtensions;
  readonly attribute SVGStringList systemLanguage;

  boolean hasExtension(DOMString extension);
};
Attributes:
requiredFeatures (readonly SVGStringList)
Corresponds to attribute 'requiredFeatures' on the given element.
requiredExtensions (readonly SVGStringList)
Corresponds to attribute 'requiredExtensions' on the given element.
systemLanguage (readonly SVGStringList)
Corresponds to attribute 'systemLanguage' on the given element.
Operations:
boolean hasExtension(DOMString extension)
Returns true if the user agent supports the given extension, specified by a URI.
Parameters
  1. DOMString extension
    The name of the extension, expressed as a URI.
Returns
True or false, depending on whether the given extension is supported.

Interface SVGFitToViewBox

Interface SVGFitToViewBox defines DOM attributes that apply to elements which have XML attributes 'viewBox' and 'preserveAspectRatio'.

[NoInterfaceObject]
interface SVGFitToViewBox {
  readonly attribute SVGAnimatedRect viewBox;
  readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
};
Attributes:
viewBox (readonly SVGAnimatedRect)
Corresponds to attribute 'viewBox' on the given element.
preserveAspectRatio (readonly SVGAnimatedPreserveAspectRatio)
Corresponds to attribute 'preserveAspectRatio' on the given element.

Interface SVGZoomAndPan

The SVGZoomAndPan interface defines attribute zoomAndPan and associated constants.

[NoInterfaceObject]
interface SVGZoomAndPan {

  // Zoom and Pan Types
  const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0;
  const unsigned short SVG_ZOOMANDPAN_DISABLE = 1;
  const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2;

  attribute unsigned short zoomAndPan;
};
Constants in group “Zoom and Pan Types”:
SVG_ZOOMANDPAN_UNKNOWN (unsigned short)
The enumeration was set to a value that is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
SVG_ZOOMANDPAN_DISABLE (unsigned short)
Corresponds to value 'disable'.
SVG_ZOOMANDPAN_MAGNIFY (unsigned short)
Corresponds to value 'magnify'.
Attributes:
zoomAndPan (unsigned short)
Corresponds to attribute 'zoomAndPan' on the given element. The value must be one of the SVG_ZOOMANDPAN_* constants defined on this interface.

Interface SVGViewSpec

The interface corresponds to an SVG View Specification.
interface SVGViewSpec {
  readonly attribute SVGTransformList transform;
  readonly attribute SVGElement viewTarget;
  readonly attribute DOMString viewBoxString;
  readonly attribute DOMString preserveAspectRatioString;
  readonly attribute DOMString transformString;
  readonly attribute DOMString viewTargetString;
};

SVGViewSpec implements SVGFitToViewBox;
SVGViewSpec implements SVGZoomAndPan;
Attributes:
transform (readonly SVGTransformList)
Corresponds to the transform setting on the SVG View Specification.
viewTarget (readonly SVGElement)
Corresponds to the viewTarget setting on the SVG View Specification.
viewBoxString (readonly DOMString)
Corresponds to the viewBox setting on the SVG View Specification.
preserveAspectRatioString (readonly DOMString)
Corresponds to the preserveAspectRatio setting on the SVG View Specification.
transformString (readonly DOMString)
Corresponds to the transform setting on the SVG View Specification.
viewTargetString (readonly DOMString)
Corresponds to the viewTarget setting on the SVG View Specification.

Interface SVGURIReference

Interface SVGURIReference defines an interface which applies to all elements which have an 'xlink:href' attribute.

[NoInterfaceObject]
interface SVGURIReference {
  readonly attribute SVGAnimatedString href;
};
Attributes:
href (readonly SVGAnimatedString)
Corresponds to the 'xlink:href' attribute.

Interface SVGCSSRule

SVG extends interface CSSRule with interface SVGCSSRule by adding an SVGColorProfileRule rule to allow for specification of ICC-based color.

It is likely that this extension will become part of a future version of CSS and DOM.

interface SVGCSSRule : CSSRule {
  const unsigned short COLOR_PROFILE_RULE = 7;
};
Constants:
COLOR_PROFILE_RULE (unsigned short)
The rule is an @color-profile.

Interface SVGRenderingIntent

The SVGRenderingIntent interface defines the enumerated list of possible values for the ‘rendering-intent’ descriptor on an @color-profile rule.

[NoInterfaceObject]
interface SVGRenderingIntent {
  // Rendering Intent Types
  const unsigned short RENDERING_INTENT_UNKNOWN = 0;
  const unsigned short RENDERING_INTENT_AUTO = 1;
  const unsigned short RENDERING_INTENT_PERCEPTUAL = 2;
  const unsigned short RENDERING_INTENT_RELATIVE_COLORIMETRIC = 3;
  const unsigned short RENDERING_INTENT_SATURATION = 4;
  const unsigned short RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5;
};
Constants in group “Rendering Intent Types”:
RENDERING_INTENT_UNKNOWN (unsigned short)
The type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type.
RENDERING_INTENT_AUTO (unsigned short)
Corresponds to a value of 'auto'.
RENDERING_INTENT_PERCEPTUAL (unsigned short)
Corresponds to a value of 'perceptual'.
RENDERING_INTENT_RELATIVE_COLORIMETRIC (unsigned short)
Corresponds to a value of 'relative-colorimetric'.
RENDERING_INTENT_SATURATION (unsigned short)
Corresponds to a value of 'saturation'.
RENDERING_INTENT_ABSOLUTE_COLORIMETRIC (unsigned short)
Corresponds to a value of 'absolute-colorimetric'.