SVGPreserveAspectRatio

SVG preserveAspectRatio interface

The SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements.

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

Interface overview

Also implement None
Methods None
Properties
  • unsigned short align
  • unsigned short meetOrSlice
Constants
  • SVG_PRESERVEASPECTRATIO_UNKNOWN = 0
  • SVG_PRESERVEASPECTRATIO_NONE = 1
  • SVG_PRESERVEASPECTRATIO_XMINYMIN = 2
  • SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3
  • SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4
  • SVG_PRESERVEASPECTRATIO_XMINYMID = 5
  • SVG_PRESERVEASPECTRATIO_XMIDYMID = 6
  • SVG_PRESERVEASPECTRATIO_XMAXYMID = 7
  • SVG_PRESERVEASPECTRATIO_XMINYMAX = 8
  • SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9
  • SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
  • SVG_MEETORSLICE_UNKNOWN = 0
  • SVG_MEETORSLICE_MEET = 1
  • SVG_MEETORSLICE_SLICE = 2
Normative document SVG 1.1 (2nd Edition)

Constants

Name Value Description
SVG_PRESERVEASPECTRATIO_UNKNOWN 0 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_PRESERVEASPECTRATIO_NONE 1 Corresponds to value none for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMIN 2 Corresponds to value xMinYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMIN 3 Corresponds to value xMidYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMIN 4 Corresponds to value xMaxYMin for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMID 5 Corresponds to value xMinYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMID 6 Corresponds to value xMidYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMID 7 Corresponds to value xMaxYMid for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMINYMAX 8 Corresponds to value xMinYMax for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMIDYMAX 9 Corresponds to value xMidYMax for attribute preserveAspectRatio.
SVG_PRESERVEASPECTRATIO_XMAXYMAX 10 Corresponds to value xMaxYMax for attribute preserveAspectRatio.
SVG_MEETORSLICE_UNKNOWN 0 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_MEETORSLICE_MEET 1 Corresponds to value meet for attribute preserveAspectRatio.
SVG_MEETORSLICE_SLICE 2 Corresponds to value slice for attribute preserveAspectRatio.

Properties

Name Type Description
align unsigned short The type of the alignment value as specified by one of the SVG_PRESERVEASPECTRATIO_* constants defined on this interface.
meetOrSlice unsigned short The type of the meet-or-slice value as specified by one of the SVG_MEETORSLICE_* constants defined on this interface.

Exceptions on setting: a DOMException with code NO_MODIFICATION_ALLOWED_ERR is raised on an attempt to change the value of an attribute on a read only object.

Methods

The SVGPreserveAspectRatio interface do not provide any specific methods.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? ? ? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ?

 

Document Tags and Contributors

Contributors to this page: Sheppy, kscarfone, Jeremie
Last updated by: kscarfone,