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 noted below, the specification of some types is different for CSS property values in style sheets (in the ‘style’ attribute,‘style’ element or an external style sheet) than it is for for XML attribute values (including presentation attribute s). 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.
Angles are specified in one of two ways depending upon whether they are used in CSS property syntax or SVG presentation attribute syntax:
The basic type is a sequence of zero or more characters. Specifically:
The basic type is a CSS2 compatible specification for a color in the sRGB color space [SRGB ]. 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.
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 inUser preferences for colors ([CSS2 ], 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 ]).
A is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for .
Frequency values are used with aural properties. As defined in CSS2, a frequency value is a immediately followed by a frequency unit identifier. The frequency unit identifiers are:
Frequency values may not be negative.
An is an ICC color specification. In SVG 1.1, an ICC color specification is given by a name, which references a ‘color-profile’ element, and one or more color component values. The grammar is as follows:
An is specified as an optional sign character ("+" or "-") followed by one or more digits "0" to "9":
If the sign character is not present, the number is non-negative.
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 SVGpresentation attribute syntax:
A consists of a separated sequence of s. String lists are white space-separated, where white space is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A) and "carriage return" (U+000D).
list-of-strings ::= string
| string wsp list-of-strings
string ::= [^#x9#xA#xD#x20]*
wsp ::= [#x9#xA#xD#x20]+
(Where T is a type other than and .) 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.
White space in lists is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A), "carriage return" (U+000D) and "form-feed" (U+000C).
Within the SVG DOM, values of a type are represented by an interface specific for the particular type T. For example, a is represented in the SVG DOM using an SVGLengthList or SVGAnimatedLengthList object.
A name, which is a string where a few characters of syntactic significance are disallowed.
Real numbers are specified in one of two ways. When used in a style sheet, a is defined as follows:
When used in an SVG attribute, a is defined differently, to allow numbers with large magnitudes to be specified more concisely:
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.
A time value is a immediately followed by a time unit identifier. The time unit identifiers are:
ms: milliseconds
s: seconds
In the SVG DOM, values are represented using the CSSPrimitiveValue interface defined in Document Object Model CSS ([DOM2STYLE ], section 2.2).
A is used to specify a list of coordinate system transformations. A detailed description of the possible values for a is given inModifying the User Coordinate System: the transform attribute .
Within the SVG DOM, a value is represented using an SVGTransformList or SVGAnimatedTransformList object.
An XML name, as defined by theName production inExtensible Markup Language (XML) 1.0 ([XML10 ], section 2.3).
4.3 Real number precisionUnless stated otherwise for a particular attribute or property , a 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.
4.4 Recognized color keyword namesThe following is the list of recognized color keywords that can be used as a keyword value for data type :
| 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.5 Basic DOM interfaces 4.5.1 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 id setraises(DOMException );
attribute DOMString xmlbase setraises(DOMException );
readonly attribute SVGSVGElement ownerSVGElement ;
readonly attribute SVGElement viewportElement ;
};
id (DOMString)
The value of the ‘id’ attribute on the given element, or the empty string if ‘id’ is not present.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
xmlbase (DOMString)
Corresponds to attribute ‘xml:base’ on the given element.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
ownerSVGElement (readonly SVGSVGElement )
viewportElement (readonly SVGElement )
The element which established the current viewport. Often, the nearest ancestor ‘svg’ element. Null if the given element is theoutermost svg element .
4.5.2 Interface SVGAnimatedBoolean Used for attributes of type boolean which can be animated.
interface SVGAnimatedBoolean {
attribute boolean baseVal setraises(DOMException );
readonly attribute boolean animVal ;
};
baseVal (boolean)
The base value of the given attribute before applying any animations.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
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 .
4.5.3 Interface SVGAnimatedString Used for attributes of type DOMString which can be animated.
interface SVGAnimatedString {
attribute DOMString baseVal setraises(DOMException );
readonly attribute DOMString animVal ;
};
baseVal (DOMString)
The base value of the given attribute before applying any animations.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
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 .
4.5.4 Interface SVGStringListThis 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.
interface SVGStringList {
readonly attribute unsigned long numberOfItems ;
void clear () raises(DOMException );
DOMString initialize (in DOMString newItem) raises(DOMException );
DOMString getItem (in unsigned long index) raises(DOMException );
DOMString insertItemBefore (in DOMString newItem, in unsigned long index) raises(DOMException );
DOMString replaceItem (in DOMString newItem, in unsigned long index) raises(DOMException );
DOMString removeItem (in unsigned long index) raises(DOMException );
DOMString appendItem (in DOMString newItem) raises(DOMException );
};
numberOfItems (readonly unsigned long)
The number of items in the list.
void clear ()
Clears all existing current items from the list, with the result being an empty list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString initialize (in DOMString newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
DOMString newItem The item which should become the only member of the list.
The item being inserted into the list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString getItem (in unsigned long index)
Returns the specified item from the list.
unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
The selected item.
DOMException , code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems .
DOMString insertItemBefore (in DOMString newItem, in unsigned long index)
Inserts a new item into the list at the specified position. The first item is number 0.
DOMString newItem The item which is to be inserted into the list.
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.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
DOMString replaceItem (in DOMString newItem, in unsigned long index)
Replaces an existing item in the list with a new item.
DOMString newItem The item which is to be inserted into the list.
unsigned long index The index of the item which is to be replaced. The first item is number 0.
The inserted item.
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 (in unsigned long index)
Removes an existing item from the list.
unsigned long index The index of the item which is to be removed. The first item is number 0.
The removed item.
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 (in DOMString newItem)
Inserts a new item at the end of the list.
DOMString newItem The item which is to be inserted. The first item is number 0.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
4.5.5 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 setraises(DOMException );
readonly attribute unsigned short animVal ;
};
baseVal (unsigned short)
The base value of the given attribute before applying any animations.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
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 .
4.5.6 Interface SVGAnimatedInteger Used for attributes of basic type which can be animated.
interface SVGAnimatedInteger {
attribute long baseVal setraises(DOMException );
readonly attribute long animVal ;
};
baseVal (long)
The base value of the given attribute before applying any animations.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
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 .
4.5.7 Interface SVGNumber Used for attributes of basic type .
interface SVGNumber {
attribute float value setraises(DOMException );
};
value (float)
The value of the given attribute.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
4.5.8 Interface SVGAnimatedNumber Used for attributes of basic type which can be animated.
interface SVGAnimatedNumber {
attribute float baseVal setraises(DOMException );
readonly attribute float animVal ;
};
baseVal (float)
The base value of the given attribute before applying any animations.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
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 .
4.5.9 Interface SVGNumberListThis 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.
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 numberOfItems ;
void clear () raises(DOMException );
SVGNumber initialize (in SVGNumber newItem) raises(DOMException );
SVGNumber getItem (in unsigned long index) raises(DOMException );
SVGNumber insertItemBefore (in SVGNumber newItem, in unsigned long index) raises(DOMException );
SVGNumber replaceItem (in SVGNumber newItem, in unsigned long index) raises(DOMException );
SVGNumber removeItem (in unsigned long index) raises(DOMException );
SVGNumber appendItem (in SVGNumber newItem) raises(DOMException );
};
numberOfItems (readonly unsigned long)
The number of items in the list.
void clear ()
Clears all existing current items from the list, with the result being an empty list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGNumber initialize (in SVGNumber newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
The item which should become the only member of the list.
The item being inserted into the list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGNumber getItem (in 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.
unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
The selected item.
DOMException , code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems .
SVGNumber insertItemBefore (in SVGNumber newItem, in 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, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item.
The item which is to be inserted into the list.
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.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGNumber replaceItem (in SVGNumber newItem, in unsigned long index)
Replaces an existing item in the list with a new item. IfnewItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to replace is before the removal of the item.
The item which is to be inserted into the list.
unsigned long index The index of the item which is to be replaced. The first item is number 0.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
DOMException , code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems .
SVGNumber removeItem (in unsigned long index)
Removes an existing item from the list.
unsigned long index The index of the item which is to be removed. The first item is number 0.
The removed item.
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 (in SVGNumber newItem)
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. The inserted item is the item itself and not a copy.
The item which is to be inserted. The first item is number 0.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list cannot be modified.
4.5.10 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 ;
};
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.
4.5.11 Interface SVGLengthThe SVGLength interface corresponds to the basic data type.
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.
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 setraises(DOMException );
attribute float valueInSpecifiedUnits setraises(DOMException );
attribute DOMString valueAsString setraises(DOMException );
void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException );
void convertToSpecifiedUnits (in unsigned short unitType) raises(DOMException );
};
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 CSS2.
SVG_LENGTHTYPE_EXS (unsigned short)
A value was specified using the ex units defined in CSS2.
SVG_LENGTHTYPE_PX (unsigned short)
A value was specified using the px units defined in CSS2.
SVG_LENGTHTYPE_CM (unsigned short)
A value was specified using the cm units defined in CSS2.
SVG_LENGTHTYPE_MM (unsigned short)
A value was specified using the mm units defined in CSS2.
SVG_LENGTHTYPE_IN (unsigned short)
A value was specified using the in units defined in CSS2.
SVG_LENGTHTYPE_PT (unsigned short)
A value was specified using the pt units defined in CSS2.
SVG_LENGTHTYPE_PC (unsigned short)
A value was specified using the pc units defined in CSS2.
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 as a floating point value, in user units. Setting this attribute will cause valueInSpecifiedUnits andvalueAsString to be updated automatically to reflect this setting.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself isread only .
valueInSpecifiedUnits (float)
The value as a floating point value, in the units expressed byunitType . Setting this attribute will cause value andvalueAsString to be updated automatically to reflect this setting.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself isread only .
valueAsString (DOMString)
The value as a string value, in the units expressed by unitType . Setting this attribute will cause value , valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.
DOMException , code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid .
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the length corresponds to a read only attribute or when the object itself isread only .
void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits)
Reset the value as a number with an associated unitType , thereby replacing the values for all of the attributes on the object.
unsigned short unitType The unit type for the value (e.g., SVG_LENGTHTYPE_MM ).
float valueInSpecifiedUnits The new value.
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 corresponds to a read only attribute or when the object itself isread only .
void convertToSpecifiedUnits (in unsigned short unitType)
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributesunitType , valueInSpecifiedUnits 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 toSVG_LENGTHTYPE_MM , valueInSpecifiedUnits would be changed to the numeric value 5 and valueAsString would be changed to "5mm".
unsigned short unitType The unit type to switch to (e.g., SVG_LENGTHTYPE_MM ).
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 corresponds to a read only attribute or when the object itself isread only .
4.5.12 Interface SVGAnimatedLength Used for attributes of basic type which can be animated.
interface SVGAnimatedLength {
readonly attribute SVGLength baseVal ;
readonly attribute SVGLength animVal ;
};
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.
4.5.13 Interface SVGLengthListThis 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.
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 numberOfItems ;
void clear () raises(DOMException );
SVGLength initialize (in SVGLength newItem) raises(DOMException );
SVGLength getItem (in unsigned long index) raises(DOMException );
SVGLength insertItemBefore (in SVGLength newItem, in unsigned long index) raises(DOMException );
SVGLength replaceItem (in SVGLength newItem, in unsigned long index) raises(DOMException );
SVGLength removeItem (in unsigned long index) raises(DOMException );
SVGLength appendItem (in SVGLength newItem) raises(DOMException );
};
numberOfItems (readonly unsigned long)
The number of items in the list.
void clear ()
Clears all existing current items from the list, with the result being an empty list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGLength initialize (in SVGLength newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy.
The item which should become the only member of the list.
The item being inserted into the list.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGLength getItem (in 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.
unsigned long index The index of the item from the list which is to be returned. The first item is number 0.
The selected item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGLength insertItemBefore (in SVGLength newItem, in 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, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to insert before is before the removal of the item.
The item which is to be inserted into the list.
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.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
SVGLength replaceItem (in SVGLength newItem, in unsigned long index)
Replaces an existing item in the list with a new item. IfnewItem is already in a list, it is removed from its previous list before it is inserted into this list. The inserted item is the item itself and not a copy. If the item is already in this list, note that the index of the item to replace is before the removal of the item.
The item which is to be inserted into the list.
unsigned long index The index of the item which is to be replaced. The first item is number 0.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
DOMException , code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems .
SVGLength removeItem (in unsigned long index)
Removes an existing item from the list.
unsigned long index The index of the item which is to be removed. The first item is number 0.
The removed item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
DOMException , code INDEX_SIZE_ERR
Raised if the index number is greater than or equal to numberOfItems .
SVGLength appendItem (in SVGLength newItem)
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. The inserted item is the item itself and not a copy.
The item which is to be inserted. The first item is number 0.
The inserted item.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the list corresponds to a read only attribute or when the object itself isread only .
4.5.14 Interface SVGAnimatedLengthList Used for attributes of type SVGLengthList which can be animated.
interface SVGAnimatedLengthList {
readonly attribute SVGLengthList baseVal ;
readonly attribute SVGLengthList animVal ;
};
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.
4.5.15 Interface SVGAngleThe SVGAngle interface corresponds to the basic data type.
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.
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 setraises(DOMException );
attribute float valueInSpecifiedUnits setraises(DOMException );
attribute DOMString valueAsString setraises(DOMException );
void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits) raises(DOMException );
void convertToSpecifiedUnits (in unsigned short unitType) raises(DOMException );
};
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.
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 angle value as a floating point value, in degrees. Setting this attribute will cause valueInSpecifiedUnits andvalueAsString to be updated automatically to reflect this setting.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself isread only .
valueInSpecifiedUnits (float)
The angle value as a floating point value, in the units expressed byunitType . Setting this attribute will cause value andvalueAsString to be updated automatically to reflect this setting.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself isread only .
valueAsString (DOMString)
The angle value as a string value, in the units expressed byunitType . Setting this attribute will cause value ,valueInSpecifiedUnits and unitType to be updated automatically to reflect this setting.
DOMException , code SYNTAX_ERR
Raised if the assigned string cannot be parsed as a valid .
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the angle corresponds to a read only attribute or when the object itself isread only .
void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits)
Reset the value as a number with an associated unitType , thereby replacing the values for all of the attributes on the object.
unsigned short unitType The unit type for the value (e.g., SVG_ANGLETYPE_DEG ).
float valueInSpecifiedUnits The angle value.
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 corresponds to a read only attribute or when the object itself isread only .
void convertToSpecifiedUnits (in unsigned short unitType)
Preserve the same underlying stored value, but reset the stored unit identifier to the given unitType. Object attributesunitType , valueInSpecifiedUnits and valueAsString might be modified as a result of this method.
unsigned short unitType The unit type to switch to (e.g., SVG_ANGLETYPE_DEG ).
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 corresponds to a read only attribute or when the object itself isread only .
4.5.16 Interface SVGAnimatedAngle Used for attributes of basic data type that can be animated.
interface SVGAnimatedAngle {
readonly attribute SVGAngle baseVal ;
readonly attribute SVGAngle animVal ;
};
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.
4.5.17 Interface SVGColorThe SVGColor interface corresponds to color value definition for properties ‘stop-color’ , ‘flood-color’ and‘lighting-color’ and is a base class for interface SVGPaint . It incorporates SVG's extended notion of color, which incorporates ICC-based color specifications.
Interface SVGColor does not correspond to the basic data type. For the basic data type, the applicable DOM interfaces are defined inDOM Level 2 Style ; in particular, see the RGBColor interface ([DOM2STYLE ], section 2.2).
Note: The SVGColor interface is deprecated, and may be dropped from future versions of the SVG specification.
interface SVGColor : CSSValue {
// Color Types
const unsigned short SVG_COLORTYPE_UNKNOWN = 0;
const unsigned short SVG_COLORTYPE_RGBCOLOR = 1;
const unsigned short SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2;
const unsigned short SVG_COLORTYPE_CURRENTCOLOR = 3;
readonly attribute unsigned short colorType ;
readonly attribute RGBColor rgbColor ;
readonly attribute SVGICCColor iccColor ;
void setRGBColor (in DOMString rgbColor) raises(SVGException );
void setRGBColorICCColor (in DOMString rgbColor, in DOMString iccColor) raises(SVGException );
void setColor (in unsigned short colorType, in DOMString rgbColor, in DOMString iccColor) raises(SVGException );
};
SVG_COLORTYPE_UNKNOWN (unsigned short)
The color 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_COLORTYPE_RGBCOLOR (unsigned short)
An sRGB color has been specified without an alternative ICC color specification.
SVG_COLORTYPE_RGBCOLOR_ICCCOLOR (unsigned short)
An sRGB color has been specified along with an alternative ICC color specification.
SVG_COLORTYPE_CURRENTCOLOR (unsigned short)
Corresponds to when keyword currentColor has been specified.
colorType (readonly unsigned short)
The type of the value as specified by one of the SVG_COLORTYPE_* constants defined on this interface.
rgbColor (readonly RGBColor )
The color specified in the sRGB color space.
iccColor (readonly SVGICCColor )
The alternate ICC color specification.
void setRGBColor (in DOMString rgbColor)
Modifies the color value to be the specified sRGB color without an alternate ICC color specification.
DOMString rgbColor A string that matches , which specifies the new sRGB color value.
SVGException , code SVG_INVALID_VALUE_ERR
Raised if rgbColor does not match .
void setRGBColorICCColor (in DOMString rgbColor, in DOMString iccColor)
Modifies the color value to be the specified sRGB color with an alternate ICC color specification.
DOMString rgbColor A string that matches , which specifies the new sRGB color value.
DOMString iccColor A string that matches , which specifies the alternate ICC color specification.
SVGException , code SVG_INVALID_VALUE_ERR
Raised if rgbColor does not match or if iccColor does not match .
void setColor (in unsigned short colorType, in DOMString rgbColor, in DOMString iccColor)
Sets the color value as specified by the parameters. IfcolorType requires an RGBColor , thenrgbColor must be a string that matches ; otherwise, rgbColor. must be null. If colorType requires an SVGICCColor , then iccColor must be a string that matches ; otherwise, iccColor must be null.
unsigned short colorType One of the defined constants for colorType .
DOMString rgbColor The specification of an sRGB color, or null.
DOMString iccColor The specification of an ICC color, or null.
SVGException , code SVG_INVALID_VALUE_ERR
Raised if one of the parameters has an invalid value.
4.5.18 Interface SVGICCColorThe SVGICCColor interface expresses an ICC-based color specification.
Note: The SVGICCColor interface is deprecated, and may be dropped from future versions of the SVG specification.
interface SVGICCColor {
attribute DOMString colorProfile setraises(DOMException );
readonly attribute SVGNumberList colors ;
};
colorProfile (DOMString)
The name of the color profile, which is the first parameter of an ICC color specification.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
colors (readonly SVGNumberList )
The list of color values that define this ICC color. Each color value is an arbitrary floating point number.
4.5.19 Interface SVGRectRepresents rectangular geometry. Rectangles are defined as consisting of a (x,y) coordinate pair identifying a minimum X value, a minimum Y value, and a width and height, which are usually constrained to be non-negative.
An SVGRect 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 SVGRect {
attribute float x setraises(DOMException );
attribute float y setraises(DOMException );
attribute float width setraises(DOMException );
attribute float height setraises(DOMException );
};
x (float)
The x coordinate of the rectangle, in user units.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself isread only .
y (float)
The y coordinate of the rectangle, in user units.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself isread only .
width (float)
The width coordinate of the rectangle, in user units.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself isread only .
height (float)
The height coordinate of the rectangle, in user units.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised when the rectangle corresponds to a read only attribute or when the object itself isread only .
4.5.20 Interface SVGAnimatedRect Used for attributes of type SVGRect which can be animated.
interface SVGAnimatedRect {
readonly attribute SVGRect baseVal ;
readonly attribute SVGRect animVal ;
};
baseVal (readonly SVGRect )
The base value of the given attribute before applying any animations.
animVal (readonly SVGRect )
A read only SVGRect representing the current animated value of the given attribute. If the given attribute is not currently being animated, then the SVGRect 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.
4.5.21 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 .
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;
};
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'.
4.5.22 Interface SVGStylable The SVGStylable interface is implemented on all objects corresponding to SVG elements that can have ‘style’ ,‘class’ and presentation attributes specified on them. It is thus an ancestor interface for many of the interfaces defined in this specification.
interface SVGStylable {
readonly attribute SVGAnimatedString className ;
readonly attribute CSSStyleDeclaration style ;
CSSValue getPresentationAttribute (in DOMString name);
};
className (readonly SVGAnimatedString )
Corresponds to attribute ‘class’ on the given element.
style (readonly CSSStyleDeclaration )
Corresponds to attribute ‘style’ on the given element. If the user agent does not support styling with CSS , then this attribute must always have the value of null.
CSSValue getPresentationAttribute (in DOMString name)
Returns the base (i.e., static) value of a given presentation attribute as an object of type CSSValue . The returned object is live; changes to the objects represent immediate changes to the objects to which the CSSValue is attached.
Note: The getPresentationAttribute
method is deprecated, and may be dropped from future versions of the SVG specification.
DOMString name The name of the presentation attribute whose value is to be returned.
The static/base value of the given presentation attribute as a CSSValue , or null if the given attribute does not have a specified value.
4.5.23 Interface SVGLocatable Interface SVGLocatable is for all elements which either have a‘transform’ attribute or don't have a ‘transform’ attribute but whose content can have a bounding box in current user space.
interface SVGLocatable {
readonly attribute SVGElement nearestViewportElement ;
readonly attribute SVGElement farthestViewportElement ;
SVGRect getBBox ();
SVGMatrix getCTM ();
SVGMatrix getScreenCTM ();
SVGMatrix getTransformToElement (in SVGElement element) raises(SVGException );
};
nearestViewportElement (readonly SVGElement )
The element which established the current viewport. Often, the nearest ancestor ‘svg’ element. Null if the current element is theoutermost svg element .
farthestViewportElement (readonly SVGElement )
SVGRect getBBox ()
Returns the tight bounding box in current user space (i.e., after application of the ‘transform’ attribute, if any) on the geometry of all contained graphics elements, exclusive of stroking, clipping, masking and filter effects). Note that getBBox must return the actual bounding box at the time the method was called, even in case the element has not yet been rendered.
An SVGRect object that defines the bounding box.
SVGMatrix getCTM ()
Returns the transformation matrix from current user units (i.e., after application of the ‘transform’ attribute, if any) to the viewport coordinate system for the nearestViewportElement .
An SVGMatrix object that defines the CTM.
SVGMatrix getScreenCTM ()
Returns the transformation matrix from current user units (i.e., after application of the ‘transform’ attribute, if any) 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 CSS2 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.
An SVGMatrix object that defines the given transformation matrix.
SVGMatrix getTransformToElement (in SVGElement element)
Returns the transformation matrix from the user coordinate system on the current element (after application of the ‘transform’ attribute, if any) to the user coordinate system on parameter element (after application of its ‘transform’ attribute, if any).
The target element.
An SVGMatrix object that defines the transformation.
SVGException , code SVG_MATRIX_NOT_INVERTABLE
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 SVGTransformable contains properties and methods that apply to all elements which have attribute ‘transform’ .
interface SVGTransformable : SVGLocatable {
readonly attribute SVGAnimatedTransformList transform ;
};
transform (readonly SVGAnimatedTransformList )
Corresponds to attribute ‘transform’ on the given element.
4.5.25 Interface SVGTests Interface SVGTests defines an interface which applies to all elements which have attributes ‘requiredFeatures’ ,‘requiredExtensions’ and ‘systemLanguage’ .
interface SVGTests {
readonly attribute SVGStringList requiredFeatures ;
readonly attribute SVGStringList requiredExtensions ;
readonly attribute SVGStringList systemLanguage ;
boolean hasExtension (in DOMString extension);
};
requiredFeatures (readonly SVGStringList )
requiredExtensions (readonly SVGStringList )
systemLanguage (readonly SVGStringList )
boolean hasExtension (in DOMString extension)
Returns true if the user agent supports the given extension, specified by a URI.
DOMString extension The name of the extension, expressed as a URI.
True or false, depending on whether the given extension is supported.
4.5.26 Interface SVGLangSpace Interface SVGLangSpace defines an interface which applies to all elements which have attributes ‘xml:lang’ and ‘xml:space’ .
interface SVGLangSpace {
attribute DOMString xmllang setraises(DOMException );
attribute DOMString xmlspace setraises(DOMException );
};
xmllang (DOMString)
Corresponds to attribute ‘xml:lang’ on the given element.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
xmlspace (DOMString)
Corresponds to attribute ‘xml:space’ on the given element.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
4.5.27 Interface SVGExternalResourcesRequired Interface SVGExternalResourcesRequired defines an interface which applies to all elements where this element or one of its descendants can reference an external resource.
interface SVGExternalResourcesRequired {
readonly attribute SVGAnimatedBoolean externalResourcesRequired ;
};
externalResourcesRequired (readonly SVGAnimatedBoolean )
4.5.28 Interface SVGFitToViewBox Interface SVGFitToViewBox defines DOM attributes that apply to elements which have XML attributes ‘viewBox’ and‘preserveAspectRatio’ .
interface SVGFitToViewBox {
readonly attribute SVGAnimatedRect viewBox ;
readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio ;
};
viewBox (readonly SVGAnimatedRect )
Corresponds to attribute ‘viewBox’ on the given element.
preserveAspectRatio (readonly SVGAnimatedPreserveAspectRatio )
4.5.29 Interface SVGZoomAndPan The SVGZoomAndPan interface defines attribute zoomAndPan and associated constants.
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 setraises(DOMException );
};
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'.
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.
DOMException , code NO_MODIFICATION_ALLOWED_ERR
Raised on an attempt to change the value of a read only attribute .
4.5.30 Interface SVGViewSpec The interface corresponds to an SVG View Specification.
interface SVGViewSpec : SVGZoomAndPan ,
SVGFitToViewBox {
readonly attribute SVGTransformList transform ;
readonly attribute SVGElement viewTarget ;
readonly attribute DOMString viewBoxString ;
readonly attribute DOMString preserveAspectRatioString ;
readonly attribute DOMString transformString ;
readonly attribute DOMString viewTargetString ;
};
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.
4.5.31 Interface SVGURIReference Interface SVGURIReference defines an interface which applies to all elements which have the collection of XLink attributes, such as‘xlink:href’, which define a URI reference.
interface SVGURIReference {
readonly attribute SVGAnimatedString href ;
};
href (readonly SVGAnimatedString )
Corresponds to attribute ‘xlink:href’ on the given element.
4.5.32 Interface SVGCSSRuleSVG 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;
};
COLOR_PROFILE_RULE (unsigned short)
4.5.33 Interface SVGRenderingIntent The SVGRenderingIntent interface defines the enumerated list of possible values for ‘rendering-intent’ attributes or descriptors.
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;
};
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'.