The common data types for SVG's properties and attributes fall into the following categories:
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, SVGList, SVGLengthList, SVGAnimatedLengthList, SVGAnimatedString, SVGAnimatedBoolean, SVGAnimatedEnumeration, SVGAngle, SVGAnimatedAngle, SVGColor, SVGICCColor, SVGAnimatedInteger, SVGLength, SVGAnimatedLength, SVGAnimatedNumber, SVGNumberList, SVGAnimatedNumberList, SVGRect, SVGAnimatedRect, SVGUnitTypes, SVGStylable, 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 readonly attribute SVGSVGElement ownerSVGElement; readonly attribute SVGElement viewportElement; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
This interface defines a set of generic list handling attributes and methods.
interface SVGList { readonly attribute unsigned long numberOfItems; void clear ( ) raises( DOMException ); Object initialize ( in Object newItem ) raises( DOMException, SVGException ); Object createItem ( ); Object getItem ( in unsigned long index ) raises( DOMException ); Object insertItemBefore ( in Object newItem, in unsigned long index ) raises( DOMException, SVGException ); Object replaceItem ( in Object newItem, in unsigned long index ) raises( DOMException, SVGException ); Object removeItem ( in unsigned long index ) raises( DOMException ); Object appendItem ( in Object newItem ) raises( DOMException, SVGException ); };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the list cannot be modified.
|
in Object newItem | The item which should become the only member of the list. |
Object | 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.
|
Object | The created item. |
in unsigned long index | The index of the item from the list which is to be returned. The first item is number 0. |
Object | The selected item. |
DOMException |
INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.
|
in Object 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 less than or 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. |
Object | 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 Object 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. |
Object | 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. |
Object | 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 Object newItem | The item which is to be inserted into the list. The first item is number 0. |
Object | 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.
|
Used for values that can be expressed as an array of SVGLengths.
The various methods inherited from SVGList, which are defined in SVGList to accept parameters and return values of type Object, must receive parameters of type SVGLength and return values of type SVGLength.
interface SVGLengthList : SVGList {};
interface SVGAnimatedLengthList { attribute SVGLengthList baseVal; // raises DOMException on setting readonly attribute SVGLengthList animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
interface SVGAnimatedString { attribute DOMString baseVal; // raises DOMException on setting readonly attribute DOMString animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
interface SVGAnimatedBoolean { attribute boolean baseVal; // raises DOMException on setting readonly attribute boolean animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
interface SVGAnimatedEnumeration { attribute unsigned short baseVal; // raises DOMException on setting readonly attribute unsigned short animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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 when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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). |
interface SVGAnimatedAngle { attribute SVGAngle baseVal; // raises DOMException on setting readonly attribute SVGAngle animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
The SVGColor 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 <color> basic data type. For the <color> basic data type, the applicable DOM interfaces are defined in [DOM2-CSS]; in particular, see the [DOM2-CSS-RGBCOLOR].
interface SVGColor : css::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; readonly attribute unsigned short colorType; readonly attribute css::RGBColor rgbColor; readonly attribute SVGICCColor iccColor; void setRGBColor ( in css::RGBColor rgbColor ); void setRGBColorICCColor ( in css::RGBColor rgbColor, in SVGICCColor iccColor ); css::RGBColor createRGBColor ( ); SVGICCColor createSVGICCColor ( ); };
SVG_COLORTYPE_UNKNOWN | 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 | An sRGB color has been specified without an alternative ICC color specification. | |
SVG_COLORTYPE_RGBCOLOR_ICCCOLOR | An sRGB color has been specified along with an alternative ICC color specification. |
in css::RGBColor rgbColor | The new sRGB color specification. |
in css::RGBColor rgbColor | The new sRGB color specification. | |
in SVGICCColor iccColor | The alternate ICC color specification. |
css::RGBColor | The returned RGBColor object. |
SVGICCColor | The returned SVGICCColor object. |
The SVGICCColor expresses an ICC-based color specification and is a base class for interface SVGColor
interface SVGICCColor { attribute DOMString colorProfile; // raises DOMException on setting readonly attribute SVGList colors; };
The name of the color profile, which is the first parameter of an ICC color specification.
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
The list of color values that define this ICC color. Each color value is an arbitrary floating point number.
The various methods from SVGList, which are defined to accept parameters and return values of type Object, must receive parameters of type float and return values of type float.
interface SVGAnimatedInteger { attribute long baseVal; // raises DOMException on setting readonly attribute long animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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 when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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 { attribute SVGLength baseVal; // raises DOMException on setting readonly attribute SVGLength animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
interface SVGAnimatedNumber { attribute float baseVal; // raises DOMException on setting readonly attribute float animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
Used for values that can be expressed as an array of numbers (i.e., each entry is a 'float').
The various methods inherited from SVGList, which are defined in SVGList to accept parameters and return values of type Object, must receive parameters of type float and return values of type float.
interface SVGNumberList : SVGList {};
interface SVGAnimatedNumberList { attribute SVGNumberList baseVal; // raises DOMException on setting readonly attribute SVGNumberList animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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.
interface SVGRect { attribute float x; // raises DOMException on setting attribute float y; // raises DOMException on setting attribute float width; // raises DOMException on setting attribute float height; // raises DOMException on setting };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
interface SVGAnimatedRect { attribute SVGRect baseVal; // raises DOMException on setting readonly attribute SVGRect animVal; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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_USERSPACE = 2; const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 3; };
SVG_UNIT_TYPE_UNKNOWN | 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 | Corresponds to value userSpaceOnUse. | |
SVG_UNIT_TYPE_USERSPACE | Corresponds to value userSpace. | |
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX | Corresponds to value objectBoundingBox. |
interface SVGStylable { readonly attribute SVGAnimatedString className; readonly attribute css::CSSStyleDeclaration style; css::CSSValue getPresentationAttribute ( in DOMString name ); css::CSSValue getAnimatedPresentationAttribute ( in DOMString name ); };
in DOMString name | Retrieves a "presentation attribute" by name. |
css::CSSValue |
The static/base value of the given presentation attribute as a CSSValue, or NULL if the given attribute does not have a specified value. 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'. |
in DOMString name | Retrieves the current animated value of a "presentation attribute" by name. |
css::CSSValue | The current animated value of the given presentation attribute as a CSSValue, or NULL if the given attribute does not have a specified value. |
Interface SVGTransformable contains properties and methods that apply to all elements which have attribute transform.
interface SVGTransformable { readonly attribute SVGElement nearestViewportElement; readonly attribute SVGElement farthestViewportElement; readonly attribute SVGAnimatedTransformList transform; SVGRect getBBox ( ); SVGMatrix getCTM ( ); SVGMatrix getScreenCTM ( ); SVGMatrix getTransformToElement ( in SVGElement element ) raises( SVGException ); };
SVGRect | An SVGRect object that defines the bounding box. |
SVGMatrix | An SVGMatrix object that defines the CTM. |
SVGMatrix | An SVGMatrix object that defines the given transformation matrix. |
in SVGElement element | The target element. |
SVGMatrix | An SVGMatrix object that defines the transformation. |
SVGException |
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 SVGTests defines an interface which applies to all elements which have attributes requiredFeatures, requiredExtensions and systemLanguage.
interface SVGTests { attribute SVGList requiredFeatures; // raises DOMException on setting attribute SVGList requiredExtensions; // raises DOMException on setting attribute SVGList systemLanguage; // raises DOMException on setting boolean hasExtension ( in DOMString extension ); };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
in DOMString extension | The name of the extension, expressed as a URI. |
boolean | True or false, depending on whether the given extension is supported. |
Interface SVGLangSpace defines an interface which applies to all elements which have attributes xml:lang and xml:space.
interface SVGLangSpace { attribute DOMString xmllang; // raises DOMException on setting attribute DOMString xmlspace; // raises DOMException on setting };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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; };
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; };
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; const unsigned short SVG_ZOOMANDPAN_ZOOM = 3; attribute unsigned short zoomAndPan; // raises DOMException on setting };
SVG_ZOOMANDPAN_UNKNOWN | 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 | Corresponds to value disable. | |
SVG_ZOOMANDPAN_MAGNIFY | Corresponds to value magnify. | |
SVG_ZOOMANDPAN_ZOOM | Corresponds to value zoom. |
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
The interface corresponds to an SVG View Specification.
interface SVGViewSpec : SVGZoomAndPan, SVGFitToViewBox { attribute SVGTransformList transform; // raises DOMException on setting attribute SVGElement viewTarget; // raises DOMException on setting readonly attribute DOMString viewBoxString; readonly attribute DOMString preserveAspectRatioString; readonly attribute DOMString transformString; readonly attribute DOMString viewTargetString; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
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 { attribute DOMString xlinkType; // raises DOMException on setting attribute DOMString xlinkRole; // raises DOMException on setting attribute DOMString xlinkArcRole; // raises DOMException on setting attribute DOMString xlinkTitle; // raises DOMException on setting attribute DOMString xlinkShow; // raises DOMException on setting attribute DOMString xlinkActuate; // raises DOMException on setting readonly attribute SVGAnimatedString href; };
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
DOMException |
NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
|
SVG extends interface CSSRule with interface SVGCSSRule by adding an SVGColorProfileRule rule to allow for specification of ICC-based color.
It is likely that this extension will become part of a future version of CSS and DOM.
interface SVGCSSRule : css::CSSRule { // Additional CSS RuleType to support ICC color specifications const unsigned short COLOR_PROFILE_RULE = 7; };
COLOR_PROFILE_RULE | The rule is an @color-profile. |
The SVGRenderingIntent 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 | 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 | Corresponds to a value of auto. | |
RENDERING_INTENT_PERCEPTUAL | Corresponds to a value of perceptual. | |
RENDERING_INTENT_RELATIVE_COLORIMETRIC | Corresponds to a value of relative-colorimetric. | |
RENDERING_INTENT_SATURATION | Corresponds to a value of saturation. | |
RENDERING_INTENT_ABSOLUTE_COLORIMETRIC | Corresponds to a value of absolute-colorimetric. |