19 July, 2001

4 Basic Data Types and Interfaces


Contents


4.1 Basic data types

The common data types for SVG's properties and attributes fall into the following categories:


4.2 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>:

alicebluergb(240, 248, 255)
antiquewhitergb(250, 235, 215)
aquargb( 0, 255, 255)
aquamarinergb(127, 255, 212)
azurergb(240, 255, 255)
beigergb(245, 245, 220)
bisquergb(255, 228, 196)
blackrgb( 0, 0, 0)
blanchedalmondrgb(255, 235, 205)
bluergb( 0, 0, 255)
bluevioletrgb(138, 43, 226)
brownrgb(165, 42, 42)
burlywoodrgb(222, 184, 135)
cadetbluergb( 95, 158, 160)
chartreusergb(127, 255, 0)
chocolatergb(210, 105, 30)
coralrgb(255, 127, 80)
cornflowerbluergb(100, 149, 237)
cornsilkrgb(255, 248, 220)
crimsonrgb(220, 20, 60)
cyanrgb( 0, 255, 255)
darkbluergb( 0, 0, 139)
darkcyanrgb( 0, 139, 139)
darkgoldenrodrgb(184, 134, 11)
darkgrayrgb(169, 169, 169)
darkgreenrgb( 0, 100, 0)
darkgreyrgb(169, 169, 169)
darkkhakirgb(189, 183, 107)
darkmagentargb(139, 0, 139)
darkolivegreenrgb( 85, 107, 47)
darkorangergb(255, 140, 0)
darkorchidrgb(153, 50, 204)
darkredrgb(139, 0, 0)
darksalmonrgb(233, 150, 122)
darkseagreenrgb(143, 188, 143)
darkslatebluergb( 72, 61, 139)
darkslategrayrgb( 47, 79, 79)
darkslategreyrgb( 47, 79, 79)
darkturquoisergb( 0, 206, 209)
darkvioletrgb(148, 0, 211)
deeppinkrgb(255, 20, 147)
deepskybluergb( 0, 191, 255)
dimgrayrgb(105, 105, 105)
dimgreyrgb(105, 105, 105)
dodgerbluergb( 30, 144, 255)
firebrickrgb(178, 34, 34)
floralwhitergb(255, 250, 240)
forestgreenrgb( 34, 139, 34)
fuchsiargb(255, 0, 255)
gainsbororgb(220, 220, 220)
ghostwhitergb(248, 248, 255)
goldrgb(255, 215, 0)
goldenrodrgb(218, 165, 32)
grayrgb(128, 128, 128)
greyrgb(128, 128, 128)
greenrgb( 0, 128, 0)
greenyellowrgb(173, 255, 47)
honeydewrgb(240, 255, 240)
hotpinkrgb(255, 105, 180)
indianredrgb(205, 92, 92)
indigorgb( 75, 0, 130)
ivoryrgb(255, 255, 240)
khakirgb(240, 230, 140)
lavenderrgb(230, 230, 250)
lavenderblushrgb(255, 240, 245)
lawngreenrgb(124, 252, 0)
lemonchiffonrgb(255, 250, 205)
lightbluergb(173, 216, 230)
lightcoralrgb(240, 128, 128)
lightcyanrgb(224, 255, 255)
lightgoldenrodyellowrgb(250, 250, 210)
lightgrayrgb(211, 211, 211)
lightgreenrgb(144, 238, 144)
lightgreyrgb(211, 211, 211)
    
lightpinkrgb(255, 182, 193)
lightsalmonrgb(255, 160, 122)
lightseagreenrgb( 32, 178, 170)
lightskybluergb(135, 206, 250)
lightslategrayrgb(119, 136, 153)
lightslategreyrgb(119, 136, 153)
lightsteelbluergb(176, 196, 222)
lightyellowrgb(255, 255, 224)
limergb( 0, 255, 0)
limegreenrgb( 50, 205, 50)
linenrgb(250, 240, 230)
magentargb(255, 0, 255)
maroonrgb(128, 0, 0)
mediumaquamarinergb(102, 205, 170)
mediumbluergb( 0, 0, 205)
mediumorchidrgb(186, 85, 211)
mediumpurplergb(147, 112, 219)
mediumseagreenrgb( 60, 179, 113)
mediumslatebluergb(123, 104, 238)
mediumspringgreenrgb( 0, 250, 154)
mediumturquoisergb( 72, 209, 204)
mediumvioletredrgb(199, 21, 133)
midnightbluergb( 25, 25, 112)
mintcreamrgb(245, 255, 250)
mistyrosergb(255, 228, 225)
moccasinrgb(255, 228, 181)
navajowhitergb(255, 222, 173)
navyrgb( 0, 0, 128)
oldlacergb(253, 245, 230)
olivergb(128, 128, 0)
olivedrabrgb(107, 142, 35)
orangergb(255, 165, 0)
orangeredrgb(255, 69, 0)
orchidrgb(218, 112, 214)
palegoldenrodrgb(238, 232, 170)
palegreenrgb(152, 251, 152)
paleturquoisergb(175, 238, 238)
palevioletredrgb(219, 112, 147)
papayawhiprgb(255, 239, 213)
peachpuffrgb(255, 218, 185)
perurgb(205, 133, 63)
pinkrgb(255, 192, 203)
plumrgb(221, 160, 221)
powderbluergb(176, 224, 230)
purplergb(128, 0, 128)
redrgb(255, 0, 0)
rosybrownrgb(188, 143, 143)
royalbluergb( 65, 105, 225)
saddlebrownrgb(139, 69, 19)
salmonrgb(250, 128, 114)
sandybrownrgb(244, 164, 96)
seagreenrgb( 46, 139, 87)
seashellrgb(255, 245, 238)
siennargb(160, 82, 45)
silverrgb(192, 192, 192)
skybluergb(135, 206, 235)
slatebluergb(106, 90, 205)
slategrayrgb(112, 128, 144)
slategreyrgb(112, 128, 144)
snowrgb(255, 250, 250)
springgreenrgb( 0, 255, 127)
steelbluergb( 70, 130, 180)
tanrgb(210, 180, 140)
tealrgb( 0, 128, 128)
thistlergb(216, 191, 216)
tomatorgb(255, 99, 71)
turquoisergb( 64, 224, 208)
violetrgb(238, 130, 238)
wheatrgb(245, 222, 179)
whitergb(255, 255, 255)
whitesmokergb(245, 245, 245)
yellowrgb(255, 255, 0)
yellowgreenrgb(154, 205, 50)
  

4.3 Basic DOM interfaces

The following interfaces are defined below: SVGElement, SVGAnimatedBoolean, SVGAnimatedString, SVGStringList, SVGAnimatedEnumeration, SVGAnimatedInteger, SVGNumber, SVGAnimatedNumber, SVGNumberList, SVGAnimatedNumberList, SVGLength, SVGAnimatedLength, SVGLengthList, SVGAnimatedLengthList, SVGAngle, SVGAnimatedAngle, SVGColor, SVGICCColor, SVGRect, SVGAnimatedRect, SVGUnitTypes, SVGStylable, SVGLocatable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan, SVGViewSpec, SVGURIReference, SVGCSSRule, SVGRenderingIntent.


Interface SVGElement

All of the SVG DOM interfaces that correspond directly to elements in the SVG language (e.g., the SVGPathElement interface corresponds directly to the 'path' element in the language) are derivative from base class SVGElement.


IDL Definition
interface SVGElement : Element { 
           attribute DOMString id;
                       // raises DOMException on setting
           attribute DOMString xmlbase;
                       // raises DOMException on setting
  readonly attribute SVGSVGElement ownerSVGElement;
  readonly attribute SVGElement viewportElement;
};

Attributes
DOMString id
The value of the id attribute on the given element.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
DOMString xmlbase
Corresponds to attribute xml:base on the given element.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly SVGSVGElement ownerSVGElement
The nearest ancestor 'svg' element. Null if the given element is the outermost 'svg' element.
readonly SVGElement viewportElement
The element which established the current viewport. Often, the nearest ancestor 'svg' element. Null if the given element is the outermost 'svg' element.

Interface SVGAnimatedBoolean

Used for attributes of type boolean which can be animated.

IDL Definition
interface SVGAnimatedBoolean { 

           attribute boolean baseVal;
                       // raises DOMException on setting
  readonly attribute boolean animVal;
};

Attributes
boolean baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly boolean animVal
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.

IDL Definition
interface SVGAnimatedString { 

           attribute DOMString baseVal;
                       // raises DOMException on setting
  readonly attribute DOMString animVal;
};

Attributes
DOMString baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly DOMString animVal
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 objects.

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.


IDL Definition
interface SVGStringList { 

  readonly attribute unsigned long numberOfItems;

  void   clear (  )
                  raises( DOMException );
  DOMString initialize ( in DOMString newItem )
                  raises( DOMException, SVGException );
  DOMString getItem ( in unsigned long index )
                  raises( DOMException );
  DOMString insertItemBefore ( in DOMString newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  DOMString replaceItem ( in DOMString newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  DOMString removeItem ( in unsigned long index )
                  raises( DOMException );
  DOMString appendItem ( in DOMString newItem )
                  raises( DOMException, SVGException );
};

Attributes
readonly unsigned long numberOfItems
The number of items in the list.
Methods
clear
Clears all existing current items from the list, with the result being an empty list.
No Parameters
No Return Value
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
initialize
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
Parameters
in DOMString newItem The item which should become the only member of the list.
Return value
DOMString The item being inserted into the list.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
getItem
Returns the specified item from the list.
Parameters
in unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
Return value
DOMString The selected item.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
insertItemBefore
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in DOMString newItem The item which is to be inserted into the list.
in 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.
Return value
DOMString The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
replaceItem
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in DOMString newItem The item which is to be inserted into the list.
in unsigned long index The index of the item which is to be replaced. The first item is number 0.
Return value
DOMString The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
removeItem
Removes an existing item from the list.
Parameters
in unsigned long index The index of the item which is to be removed. The first item is number 0.
Return value
DOMString The removed item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
appendItem
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in DOMString newItem The item which is to be inserted into the list. The first item is number 0.
Return value
DOMString The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.

Interface SVGAnimatedEnumeration

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

IDL Definition
interface SVGAnimatedEnumeration { 

           attribute unsigned short baseVal;
                       // raises DOMException on setting
  readonly attribute unsigned short animVal;
};

Attributes
unsigned short baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly unsigned short animVal
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.

IDL Definition
interface SVGAnimatedInteger { 

           attribute long baseVal;
                       // raises DOMException on setting
  readonly attribute long animVal;
};

Attributes
long baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly long animVal
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'.

IDL Definition
interface SVGNumber { 

           attribute float value;
                       // raises DOMException on setting
};

Attributes
float value
The value of the given attribute.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.

Interface SVGAnimatedNumber

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

IDL Definition
interface SVGAnimatedNumber { 

           attribute float baseVal;
                       // raises DOMException on setting
  readonly attribute float animVal;
};

Attributes
float baseVal
The base value of the given attribute before applying any animations.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
readonly float animVal
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.


IDL Definition
interface SVGNumberList { 

  readonly attribute unsigned long numberOfItems;

  void   clear (  )
                  raises( DOMException );
  SVGNumber initialize ( in SVGNumber newItem )
                  raises( DOMException, SVGException );
  SVGNumber getItem ( in unsigned long index )
                  raises( DOMException );
  SVGNumber insertItemBefore ( in SVGNumber newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  SVGNumber replaceItem ( in SVGNumber newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  SVGNumber removeItem ( in unsigned long index )
                  raises( DOMException );
  SVGNumber appendItem ( in SVGNumber newItem )
                  raises( DOMException, SVGException );
};

Attributes
readonly unsigned long numberOfItems
The number of items in the list.
Methods
clear
Clears all existing current items from the list, with the result being an empty list.
No Parameters
No Return Value
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
initialize
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
Parameters
in SVGNumber newItem The item which should become the only member of the list.
Return value
SVGNumber The item being inserted into the list.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
getItem
Returns the specified item from the list.
Parameters
in unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
Return value
SVGNumber The selected item.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
insertItemBefore
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGNumber newItem The item which is to be inserted into the list.
in 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.
Return value
SVGNumber The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
replaceItem
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGNumber newItem The item which is to be inserted into the list.
in unsigned long index The index of the item which is to be replaced. The first item is number 0.
Return value
SVGNumber The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
removeItem
Removes an existing item from the list.
Parameters
in unsigned long index The index of the item which is to be removed. The first item is number 0.
Return value
SVGNumber The removed item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
appendItem
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGNumber newItem The item which is to be inserted into the list. The first item is number 0.
Return value
SVGNumber The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.

Interface SVGAnimatedNumberList

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

IDL Definition
interface SVGAnimatedNumberList { 

  readonly attribute SVGNumberList baseVal;
  readonly attribute SVGNumberList animVal;
};

Attributes
readonly SVGNumberList baseVal
The base value of the given attribute before applying any animations.
readonly SVGNumberList animVal
If the given attribute or property is being animated, then this attribute contains the current animated value of the attribute or property, and both the object itself and its contents are readonly. If the given attribute or property is not currently being animated, then this attribute contains the same value as 'baseVal'.

Interface SVGLength

The SVGLength interface corresponds to the <length> basic data type.


IDL Definition
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;
                       // raises DOMException on setting
           attribute float          valueInSpecifiedUnits;
                       // raises DOMException on setting
           attribute DOMString      valueAsString;
                       // raises DOMException on setting

  void newValueSpecifiedUnits ( in unsigned short unitType, in float valueInSpecifiedUnits );
  void convertToSpecifiedUnits ( in unsigned short unitType );
};

Definition group Length Unit Types
Defined constants
SVG_LENGTHTYPE_UNKNOWN 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 No unit type was provided (i.e., a unitless value was specified), which indicates a value in user units.
SVG_LENGTHTYPE_PERCENTAGE A percentage value was specified.
SVG_LENGTHTYPE_EMS A value was specified using the "em" units defined in CSS2.
SVG_LENGTHTYPE_EXS A value was specified using the "ex" units defined in CSS2.
SVG_LENGTHTYPE_PX A value was specified using the "px" units defined in CSS2.
SVG_LENGTHTYPE_CM A value was specified using the "cm" units defined in CSS2.
SVG_LENGTHTYPE_MM A value was specified using the "mm" units defined in CSS2.
SVG_LENGTHTYPE_IN A value was specified using the "in" units defined in CSS2.
SVG_LENGTHTYPE_PT A value was specified using the "pt" units defined in CSS2.
SVG_LENGTHTYPE_PC A value was specified using the "pc" units defined in CSS2.
Attributes
readonly unsigned short unitType
The type of the value as specified by one of the constants specified above.
float value
The value as an floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
float valueInSpecifiedUnits
The value as an floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
DOMString valueAsString
The value as a string value, in the units expressed by unitType. Setting this attribute will cause value and valueInSpecifiedUnits to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
Methods
newValueSpecifiedUnits
Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Parameters
in unsigned short unitType The unitType for the value (e.g., SVG_LENGTHTYPE_MM).
in float valueInSpecifiedUnits The new value.
No Return Value
No Exceptions
convertToSpecifiedUnits
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueAsSpecified and valueAsString might be modified as a result of this method. For example, if the original value were "0.5cm" and the method was invoked to convert to millimeters, then the unitType would be changed to SVG_LENGTHTYPE_MM, valueAsSpecified would be changed to the numeric value 5 and valueAsString would be changed to "5mm".
Parameters
in unsigned short unitType The unitType to switch to (e.g., SVG_LENGTHTYPE_MM).
No Return Value
No Exceptions

Interface SVGAnimatedLength

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

IDL Definition
interface SVGAnimatedLength { 

  readonly attribute SVGLength baseVal;
  readonly attribute SVGLength animVal;
};

Attributes
readonly SVGLength baseVal
The base value of the given attribute before applying any animations.
readonly SVGLength animVal
If the given attribute or property is being animated, contains the current animated value of the attribute or property, and both the object itself and its contents are readonly. If the given attribute or property is not currently being animated, contains the same value as 'baseVal'.

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.


IDL Definition
interface SVGLengthList { 

  readonly attribute unsigned long numberOfItems;

  void   clear (  )
                  raises( DOMException );
  SVGLength initialize ( in SVGLength newItem )
                  raises( DOMException, SVGException );
  SVGLength getItem ( in unsigned long index )
                  raises( DOMException );
  SVGLength insertItemBefore ( in SVGLength newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  SVGLength replaceItem ( in SVGLength newItem, in unsigned long index )
                  raises( DOMException, SVGException );
  SVGLength removeItem ( in unsigned long index )
                  raises( DOMException );
  SVGLength appendItem ( in SVGLength newItem )
                  raises( DOMException, SVGException );
};

Attributes
readonly unsigned long numberOfItems
The number of items in the list.
Methods
clear
Clears all existing current items from the list, with the result being an empty list.
No Parameters
No Return Value
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
initialize
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
Parameters
in SVGLength newItem The item which should become the only member of the list.
Return value
SVGLength The item being inserted into the list.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
getItem
Returns the specified item from the list.
Parameters
in unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
Return value
SVGLength The selected item.
Exceptions
DOMException
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
insertItemBefore
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGLength newItem The item which is to be inserted into the list.
in 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.
Return value
SVGLength The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
replaceItem
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGLength newItem The item which is to be inserted into the list.
in unsigned long index The index of the item which is to be replaced. The first item is number 0.
Return value
SVGLength The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.
removeItem
Removes an existing item from the list.
Parameters
in unsigned long index The index of the item which is to be removed. The first item is number 0.
Return value
SVGLength The removed item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
appendItem
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
Parameters
in SVGLength newItem The item which is to be inserted into the list. The first item is number 0.
Return value
SVGLength The inserted item.
Exceptions
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
SVGException
SVG_WRONG_TYPE_ERR: Raised if parameter newItem is the wrong type of object for the given list.

Interface SVGAnimatedLengthList

Used for attributes of type SVGLengthList which can be animated.

IDL Definition
interface SVGAnimatedLengthList { 

  readonly attribute SVGLengthList baseVal;
  readonly attribute SVGLengthList animVal;
};

Attributes
readonly SVGLengthList baseVal
The base value of the given attribute before applying any animations.
readonly SVGLengthList animVal
If the given attribute or property is being animated, contains the current animated value of the attribute or property, and both the object itself and its contents are readonly. If the given attribute or property is not currently being animated, contains the same value as 'baseVal'.

Interface SVGAngle

The SVGAngle interface corresponds to the <angle> basic data type.


IDL Definition
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;
                       // raises DOMException on setting
           attribute float          valueInSpecifiedUnits;
                       // raises DOMException on setting
           attribute DOMString      valueAsString;
                       // raises DOMException on setting

  void newValueSpecifiedUnits ( in unsigned short unitType, in float valueInSpecifiedUnits );
  void convertToSpecifiedUnits ( in unsigned short unitType );
};

Definition group Angle Unit Types
Defined constants
SVG_ANGLETYPE_UNKNOWN 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 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 The unit type was explicitly set to degrees.
SVG_ANGLETYPE_RAD The unit type is radians.
SVG_ANGLETYPE_GRAD The unit type is grads.
Attributes
readonly unsigned short unitType
The type of the value as specified by one of the constants specified above.
float value
The angle value as a floating point value, in degrees. Setting this attribute will cause valueInSpecifiedUnits and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
float valueInSpecifiedUnits
The angle value as a floating point value, in the units expressed by unitType. Setting this attribute will cause value and valueAsString to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
DOMString valueAsString
The angle value as a string value, in the units expressed by unitType. Setting this attribute will cause value and valueInSpecifiedUnits to be updated automatically to reflect this setting.
Exceptions on setting
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
Methods
newValueSpecifiedUnits
Reset the value as a number with an associated unitType, thereby replacing the values for all of the attributes on the object.
Parameters
in unsigned short unitType The unitType for the angle value (e.g., SVG_ANGLETYPE_DEG).
in float valueInSpecifiedUnits The angle value.
No Return Value
No Exceptions
convertToSpecifiedUnits
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributes unitType, valueAsSpecified and valueAsString might be modified as a result of this method.
Parameters
in unsigned short unitType The unitType to switch to (e.g., SVG_ANGLETYPE_DEG).