The common data types for SVG's properties and attributes fall into the following categories:
ListOfXXX:
XXX
| XXX comma-wsp XXX
comma-wsp:
(wsp+ comma? wsp*) | (comma wsp*)
comma:
","
wsp:
(#x20 | #x9 | #xD | #xA)
where XXX represents a particular type of value.The following is the list of recognized color keywords that can be used as a keyword value for data type <color>:
|
|
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.
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.
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;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
interface SVGAnimatedBoolean {
attribute boolean baseVal;
// raises DOMException on setting
readonly attribute boolean animVal;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
interface SVGAnimatedString {
attribute DOMString baseVal;
// raises DOMException on setting
readonly attribute DOMString animVal;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
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.
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 );
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
|
| in DOMString newItem | The item which should become the only member of the list. |
| DOMString | The item being inserted into the list. |
| 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.
|
| in unsigned long index | The index of the item from the list which is to be returned. The first item is number 0. |
| DOMString | The selected item. |
| DOMException |
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
|
| 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. |
| DOMString | The inserted item. |
| 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.
|
| 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. |
| DOMString | The inserted item. |
| 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.
|
| in unsigned long index | The index of the item which is to be removed. The first item is number 0. |
| DOMString | The removed item. |
| 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.
|
| in DOMString newItem | The item which is to be inserted into the list. The first item is number 0. |
| DOMString | The inserted item. |
| 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 {
attribute unsigned short baseVal;
// raises DOMException on setting
readonly attribute unsigned short animVal;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
interface SVGAnimatedInteger {
attribute long baseVal;
// raises DOMException on setting
readonly attribute long animVal;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
interface SVGNumber {
attribute float value;
// raises DOMException on setting
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
interface SVGAnimatedNumber {
attribute float baseVal;
// raises DOMException on setting
readonly attribute float animVal;
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
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.
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 );
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
|
| in SVGNumber newItem | The item which should become the only member of the list. |
| SVGNumber | The item being inserted into the list. |
| 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.
|
| in unsigned long index | The index of the item from the list which is to be returned. The first item is number 0. |
| SVGNumber | The selected item. |
| DOMException |
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
|
| 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. |
| SVGNumber | The inserted item. |
| 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.
|
| 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. |
| SVGNumber | The inserted item. |
| 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.
|
| in unsigned long index | The index of the item which is to be removed. The first item is number 0. |
| SVGNumber | The removed item. |
| 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.
|
| in SVGNumber newItem | The item which is to be inserted into the list. The first item is number 0. |
| SVGNumber | The inserted item. |
| 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 {
readonly attribute SVGNumberList baseVal;
readonly attribute SVGNumberList animVal;
};
The SVGLength interface corresponds to the <length> basic data type.
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 );
};
| 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. |
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| in unsigned short unitType | The unitType for the value (e.g., SVG_LENGTHTYPE_MM). | |
| in float valueInSpecifiedUnits | The new value. |
| in unsigned short unitType | The unitType to switch to (e.g., SVG_LENGTHTYPE_MM). |
interface SVGAnimatedLength {
readonly attribute SVGLength baseVal;
readonly attribute SVGLength animVal;
};
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.
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 );
};
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
|
| in SVGLength newItem | The item which should become the only member of the list. |
| SVGLength | The item being inserted into the list. |
| 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.
|
| in unsigned long index | The index of the item from the list which is to be returned. The first item is number 0. |
| SVGLength | The selected item. |
| DOMException |
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
|
| 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. |
| SVGLength | The inserted item. |
| 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.
|
| 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. |
| SVGLength | The inserted item. |
| 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.
|
| in unsigned long index | The index of the item which is to be removed. The first item is number 0. |
| SVGLength | The removed item. |
| 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.
|
| in SVGLength newItem | The item which is to be inserted into the list. The first item is number 0. |
| SVGLength | The inserted item. |
| 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 {
readonly attribute SVGLengthList baseVal;
readonly attribute SVGLengthList animVal;
};
The SVGAngle interface corresponds to the <angle> basic data type.
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 );
};
| 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. |
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised on an attempt to change the value of a readonly attribute.
|
| in unsigned short unitType | The unitType for the angle value (e.g., SVG_ANGLETYPE_DEG). | |
| in float valueInSpecifiedUnits | The angle value. |
| in unsigned short unitType | The unitType to switch to (e.g., SVG_ANGLETYPE_DEG). |