A key interface definition is the SVGSVGElement interface,
which is the interface that corresponds to the ‘svg’ element. This
interface contains various miscellaneous commonly-used utility
methods, such as matrix operations and the ability to control the
time of redraw on visual rendering devices.
Properties |
const unsigned short | - SVG_ZOOMANDPAN_DISABLE = 1
- Corresponds to value 'disable'.
|
const unsigned short | - SVG_ZOOMANDPAN_MAGNIFY = 2
- Corresponds to value 'magnify'.
|
const unsigned short | - SVG_ZOOMANDPAN_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.
|
SVGAnimatedString | - className
- Corresponds to attribute ‘class’ on the given element.
|
DOMString | - contentScriptType
- Corresponds to attribute ‘contentScriptType’ on the given
‘svg’ element. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised on an attempt to
change the value of a read only attribute.
|
DOMString | - contentStyleType
- Corresponds to attribute ‘contentStyleType’ on the given
‘svg’ element. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised on an attempt to
change the value of a read only attribute.
|
float | - currentScale
- On an outermost svg element, this attribute indicates the
current scale factor
relative to the initial view to take into account user
magnification and panning operations, as described under
Magnification
and panning. DOM attributes currentScale and
currentTranslate
are equivalent to the 2x3 matrix [a b c d e f] =
[currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
|
SVGPoint | - currentTranslate
- On an outermost svg element, the corresponding translation factor
that takes into account user "magnification". When accessed on an ‘svg’ element that is not an
outermost svg element, it is undefined what behavior
this attribute has.
|
SVGViewSpec | - currentView
- The definition of the initial view (i.e., before magnification
and panning) of the current innermost SVG document fragment. The
meaning depends on the situation:
If the initial view was a "standard" view, then:
the values for viewBox,
preserveAspectRatio and
zoomAndPan within currentView
will match the values for the corresponding DOM attributes
that are on SVGSVGElement directlythe values for transform and
viewTarget within currentView
will be null
If the initial view was a link into a ‘view’ element, then:
the values for viewBox,
preserveAspectRatio and
zoomAndPan within currentView
will correspond to the corresponding attributes for the
given ‘view’ elementthe values for transform and
viewTarget within currentView
will be null
If the initial view was a link into another element (i.e.,
other than a ‘view’), then:
the values for viewBox,
preserveAspectRatio and
zoomAndPan within currentView
will match the values for the corresponding DOM attributes
that are on SVGSVGElement directly for the closest ancestor
‘svg’ elementthe values for transform within
currentView will be nullthe viewTarget within
currentView will represent the target of the
link
If the initial view was a link into the SVG document fragment
using an SVG view specification fragment identifier (i.e.,
#svgView(...)), then:
the values for viewBox,
preserveAspectRatio,
zoomAndPan,
transform and
viewTarget within currentView
will correspond to the values from the SVG view
specification fragment identifier
The object itself and its contents are both read only.
|
SVGAnimatedBoolean | - externalResourcesRequired
- Corresponds to attribute ‘externalResourcesRequired’ on the given
element. Note that the SVG DOM defines the attribute
‘externalResourcesRequired’ as being of type
SVGAnimatedBoolean, whereas the SVG language definition says that
‘externalResourcesRequired’ is not animated.
|
SVGElement | - farthestViewportElement
- The farthest ancestor ‘svg’ element. Null if the current element
is the outermost svg element.
|
SVGAnimatedLength | - height
- The height coordinate of the rectangle, in user units. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised when the rectangle
corresponds to a read only attribute or when the object itself is
read only.
|
SVGElement | - nearestViewportElement
- The element which established the current viewport. Often, the nearest
ancestor ‘svg’ element. Null if the current element is the
outermost svg element.
|
float | - pixelUnitToMillimeterX
- Size of a pixel units (as defined by CSS2) along the x-axis of
the viewport, which represents a unit somewhere in the range
of 70dpi to 120dpi, and, on systems that support this, might
actually match the characteristics of the target medium. On
systems where it is impossible to know the size of a pixel, a
suitable default pixel size is provided.
|
float | - pixelUnitToMillimeterY
- Corresponding size of a pixel unit along the y-axis of the viewport.
|
SVGAnimatedPreserveAspectRatio | - preserveAspectRatio
- Corresponds to attribute ‘preserveAspectRatio’ on the given element.
|
SVGStringList | - requiredExtensions
- Corresponds to attribute ‘requiredExtensions’ on the given element.
|
SVGStringList | - requiredFeatures
- Corresponds to attribute ‘requiredFeatures’ on the given element.
|
float | - screenPixelToMillimeterX
- User interface (UI) events in DOM Level 2 indicate the screen
positions at which the given UI event occurred. When the user
agent actually knows the physical size of a "screen unit", this
attribute will express that information; otherwise, user agents
will provide a suitable default value such as .28mm.
|
float | - screenPixelToMillimeterY
- Corresponding size of a screen pixel along the y-axis of the viewport.
|
CSSStyleDeclaration | - style
- 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.
|
SVGStringList | - systemLanguage
- Corresponds to attribute ‘systemLanguage’ on the given element.
|
boolean | - useCurrentView
- The initial view (i.e., before magnification and panning) of
the current innermost SVG document fragment can be either the
"standard" view (i.e., based on attributes on the ‘svg’
element such as ‘viewBox’) or to a "custom" view (i.e., a
hyperlink into a particular ‘view’ or other element - see
Linking into SVG content:
IRI fragments and SVG views).
|
SVGAnimatedRect | - viewBox
- Corresponds to attribute ‘viewBox’ on the given element.
|
SVGRect | - viewport
- The position and size of the viewport (implicit or explicit) that
corresponds to this ‘svg’ element. When the user agent is actually
rendering the content, then the position and size values represent the
actual values when rendering. The position and size values are unitless
values in the coordinate system of the parent element.
|
SVGAnimatedLength | - width
- The width coordinate of the rectangle, in user units. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised when the rectangle
corresponds to a read only attribute or when the object itself is
read only.
|
SVGAnimatedLength | - x
- The x coordinate of the rectangle, in user units. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised when the rectangle
corresponds to a read only attribute or when the object itself is
read only.
|
DOMString | - xmllang
- Corresponds to attribute ‘xml:lang’ on the given element. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised on an
attempt to change the value of a read only attribute.
|
DOMString | - xmlspace
- Corresponds to attribute ‘xml:space’ on the given element. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised on an
attempt to change the value of a read only attribute.
|
SVGAnimatedLength | - y
- The y coordinate of the rectangle, in user units. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised when the rectangle
corresponds to a read only attribute or when the object itself is
read only.
|
unsigned short | - zoomAndPan
- Corresponds to attribute ‘zoomAndPan’ on the given element. The
value must be one of the SVG_ZOOMANDPAN_* constants defined on this
interface. Exceptions on settingDOMException, code NO_MODIFICATION_ALLOWED_ERR Raised on an
attempt to change the value of a read only attribute.
|
Operations |
boolean | - animationsPaused()
- Returns true if this SVG document fragment is in a paused state. Returns Boolean indicating whether this SVG document fragment is in a
paused state.
|
boolean | - checkEnclosure(SVGElement element, SVGRect rect)
- Returns true if the rendered content of the given element is entirely
contained within the supplied rectangle. Each candidate graphics element is to
be considered a match only if the same graphics element can be a
target of pointer events
as defined in ‘pointer-events’ processing.
|
boolean | - checkIntersection(SVGElement element, SVGRect rect)
- Returns true if the rendered content of the given element intersects the
supplied rectangle. Each candidate graphics element is to
be considered a match only if the same graphics element can be a
target of pointer events
as defined in ‘pointer-events’ processing.
|
SVGAngle | - createSVGAngle()
- Creates an SVGAngle object outside of any document trees. The
object is initialized to the value 0 degrees (unitless). Returns An SVGAngle object.
|
SVGLength | - createSVGLength()
- Creates an SVGLength object outside of any document trees. The
object is initialized to the value of 0 user units. Returns An SVGLength object.
|
SVGMatrix | - createSVGMatrix()
- Creates an SVGMatrix object outside of any document trees. The
object is initialized to the identity matrix. Returns An SVGMatrix object.
|
SVGNumber | - createSVGNumber()
- Creates an SVGNumber object outside of any document trees. The
object is initialized to a value of zero. Returns An SVGNumber object.
|
SVGPoint | - createSVGPoint()
- Creates an SVGPoint object outside of any document trees. The
object is initialized to the point (0,0) in the user coordinate system. Returns An SVGPoint object.
|
SVGRect | - createSVGRect()
- Creates an SVGRect object outside of any document trees. The
object is initialized such that all values are set to 0 user units. Returns An SVGRect object.
|
SVGTransform | - createSVGTransform()
- Creates an SVGTransform object outside of any document trees. The
object is initialized to an identity matrix transform
(SVG_TRANSFORM_MATRIX). Returns An SVGTransform object.
|
SVGTransform | - createSVGTransformFromMatrix(SVGMatrix matrix)
- Creates an SVGTransform object outside of any document trees. The
object is initialized to the given matrix transform (i.e.,
SVG_TRANSFORM_MATRIX). The values from the parameter matrix
are copied, the matrix parameter is not adopted as
SVGTransform::matrix.
|
void | - deselectAll()
- Unselects any selected objects, including any selections of text strings
and type-in bars.
|
void | - forceRedraw()
- In rendering environments supporting interactivity, forces the user agent
to immediately redraw all regions of the viewport that require updating.
|
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.
|
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. Returns An SVGMatrix object that defines the CTM.
|
float | - getCurrentTime()
- Returns the current time in seconds relative to the start time for the
current SVG document fragment. If getCurrentTime is called before
the document timeline has begun (for example, by script running in a
‘script’ element before the document's
SVGLoad event is dispatched),
then 0 is returned.
|
Element | - getElementById(DOMString elementId)
- Searches this SVG document fragment (i.e., the search is restricted to a
subset of the document tree) for an Element whose id is given by
elementId. If an Element is found, that Element is returned. If
no such element exists, returns null. Behavior is not defined if more
than one element has this id.
|
NodeList | - getEnclosureList(SVGRect rect, SVGElement referenceElement)
- Returns the list of graphics elements whose rendered content is entirely
contained within the supplied rectangle. Each candidate graphics element is to
be considered a match only if the same graphics element can be a
target of pointer events
as defined in ‘pointer-events’ processing.
|
NodeList | - getIntersectionList(SVGRect rect, SVGElement referenceElement)
- Returns the list of graphics elements whose rendered content intersects
the supplied rectangle. Each candidate graphics element is to
be considered a match only if the same graphics element can be a
target of pointer events
as defined in ‘pointer-events’ processing.
|
CSSValue | - getPresentationAttribute(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.
|
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.
|
SVGMatrix | - getTransformToElement(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).
|
boolean | - hasExtension(DOMString extension)
- Returns true if the user agent supports the given extension, specified
by a URI. ParametersDOMString extension The name of the extension, expressed as a URI. Returns True or false, depending on whether the given extension is
supported.
|
void | - pauseAnimations()
- Suspends (i.e., pauses) all currently running animations that are defined
within the SVG document fragment corresponding to this ‘svg’
element, causing the animation clock corresponding to this document
fragment to stand still until it is unpaused.
|
void | - setCurrentTime(float seconds)
- Adjusts the clock for this SVG document fragment, establishing a new
current time. If setCurrentTime is called
before the document timeline has begun (for example, by script running
in a ‘script’ element before the document's
SVGLoad event is dispatched),
then the value of seconds in the last invocation of the method
gives the time that the document will seek to once the document
timeline has begun.
|
unsigned long | - suspendRedraw(unsigned long maxWaitMilliseconds)
- Takes a time-out value which indicates that redraw shall not occur until:
the corresponding unsuspendRedraw() call has been made,an unsuspendRedrawAll() call has been made, orits timer has timed out. In environments that do not support interactivity (e.g., print media),
then redraw shall not be suspended.
|
void | - unpauseAnimations()
- Unsuspends (i.e., unpauses) currently running animations that are defined
within the SVG document fragment, causing the animation clock to continue
from the time at which it was suspended.
|
void | - unsuspendRedraw(unsigned long suspendHandleID)
- Cancels a specified suspendRedraw() by providing a unique
suspend handle ID that was returned by a previous suspendRedraw() call. Parametersunsigned long suspendHandleID A number which acts as a unique identifier for
the desired suspendRedraw() call. The number supplied must be a value
returned from a previous call to suspendRedraw().
|
void | - unsuspendRedrawAll()
- Cancels all currently active suspendRedraw() method calls. This method
is most useful at the very end of a set of SVG DOM calls to ensure that
all pending suspendRedraw() method calls have been cancelled.
|