files/en-us/web/api/svgsvgelement/index.md
{{APIRef("SVG")}}
The SVGSVGElement interface provides access to the properties of {{SVGElement("svg")}} elements, as well as methods to manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices.
{{InheritanceDiagram}}
This interface also inherits properties from its parent, {{domxref("SVGGraphicsElement")}}.
{{domxref("SVGSVGElement.x")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.y")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.width")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.height")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.viewBox")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.preserveAspectRatio")}} {{ReadOnlyInline}}
{{domxref("SVGSVGElement.pixelUnitToMillimeterX")}} {{Deprecated_Inline}}
{{domxref("SVGSVGElement.pixelUnitToMillimeterY")}} {{Deprecated_Inline}}
{{domxref("SVGSVGElement.screenPixelToMillimeterX")}} {{Deprecated_Inline}}
.28mm).{{domxref("SVGSVGElement.screenPixelToMillimeterY")}} {{Deprecated_Inline}}
{{domxref("SVGSVGElement.useCurrentView")}} {{Deprecated_Inline}} {{Non-standard_Inline}}
false. If the initial view is a "custom" view, then this attribute is true.{{domxref("SVGSVGElement.currentView")}} {{Deprecated_Inline}} {{Non-standard_Inline}}
: An {{domxref("SVGViewSpec")}} defining 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:
viewBox, preserveAspectRatio, and zoomAndPan within currentView will match the values for the corresponding DOM attributes that are on SVGSVGElement directlytransform within currentView will be nullIf the initial view was a link into a {{SVGElement("view")}} element, then:
viewBox, preserveAspectRatio, and zoomAndPan within currentView will correspond to the corresponding attributes for the given {{SVGElement("view")}} elementtransform within currentView will be nullIf the initial view was a link into another element (i.e., other than a {{SVGElement("view")}}), then:
viewBox, preserveAspectRatio, and zoomAndPan within currentView will match the values for the corresponding DOM attributes that are on SVGSVGElement directly for the closest ancestor {{SVGElement("svg")}} elementtransform within currentView will be nullIf the initial view was a link into the SVG document fragment using an SVG view specification fragment identifier (i.e., #svgView(…)), then:
viewBox, preserveAspectRatio, zoomAndPan, and transform within currentView will correspond to the values from the SVG view specification fragment identifier{{domxref("SVGSVGElement.currentScale")}}
currentScale and currentTranslate are equivalent to the 2×3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]. If "magnification" is enabled (i.e., zoomAndPan="magnify"), then the effect is as if an extra transformation were placed at the outermost level on the SVG document fragment (i.e., outside the outermost {{SVGElement("svg")}} element).{{domxref("SVGSVGElement.currentTranslate")}} {{ReadOnlyInline}}
<svg> elements that are not at the outermost level.This interface also inherits methods from its parent, {{domxref("SVGGraphicsElement")}}.
{{domxref("SVGSVGElement.suspendRedraw()")}} {{Deprecated_Inline}}
: 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, or its timer has timed out.
In environments that do not support interactivity (e.g., print media), then redraw shall not be suspended. Calls to suspendRedraw() and unsuspendRedraw() should, but need not be, made in balanced pairs.
To suspend redraw actions as a collection of SVG DOM changes occur, precede the changes to the SVG DOM with a method call similar to:
const suspendHandleID = suspendRedraw(maxWaitMilliseconds);
and follow the changes with a method call similar to:
unsuspendRedraw(suspendHandleID);
Note that multiple suspendRedraw() calls can be used at once, and that each such method call is treated independently of the other suspendRedraw() method calls.
{{domxref("SVGSVGElement.unsuspendRedraw()")}} {{Deprecated_Inline}}
suspendRedraw() by providing a unique suspend handle ID that was returned by a previous suspendRedraw() call.{{domxref("SVGSVGElement.unsuspendRedrawAll()")}} {{Deprecated_Inline}}
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.{{domxref("SVGSVGElement.forceRedraw()")}} {{Deprecated_Inline}}
{{domxref("SVGSVGElement.pauseAnimations()")}}
{{domxref("SVGSVGElement.unpauseAnimations()")}}
{{domxref("SVGSVGElement.animationsPaused()")}}
true if this SVG document fragment is in a paused state.{{domxref("SVGSVGElement.getCurrentTime()")}}
getCurrentTime() is called before the document timeline has begun (for example, by script running in a {{SVGElement("script")}} element before the document's SVGLoad event is dispatched), then 0 is returned.{{domxref("SVGSVGElement.setCurrentTime()")}}
setCurrentTime() is called before the document timeline has begun (for example, by script running in a {{SVGElement("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.{{domxref("SVGSVGElement.getIntersectionList()")}}
{{domxref("SVGSVGElement.getEnclosureList()")}}
{{domxref("SVGSVGElement.checkIntersection()")}}
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 {{SVGAttr("pointer-events")}} processing.{{domxref("SVGSVGElement.checkEnclosure()")}}
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 {{SVGAttr("pointer-events")}} processing.{{domxref("SVGSVGElement.deselectAll()")}}
{{domxref("SVGSVGElement.createSVGNumber()")}}
0.{{domxref("SVGSVGElement.createSVGLength()")}}
0 user units.{{domxref("SVGSVGElement.createSVGAngle()")}}
0 degrees (unitless).{{domxref("SVGSVGElement.createSVGPoint()")}}
(0,0) in the user coordinate system.{{domxref("SVGSVGElement.createSVGMatrix()")}}
{{domxref("SVGSVGElement.createSVGRect()")}}
0 user units.{{domxref("SVGSVGElement.createSVGTransform()")}}
SVG_TRANSFORM_MATRIX).{{domxref("SVGSVGElement.createSVGTransformFromMatrix()")}}
SVG_TRANSFORM_MATRIX). The values from the parameter matrix are copied, the matrix parameter is not adopted as SVGTransform::matrix.{{domxref("SVGSVGElement.getElementById()")}}
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.The following {{domxref("Window")}} onXYZ event handler properties are also available as aliases targeting the window object. However, it is advised to listen to them on the window object directly rather than on SVGSVGElement.
[!NOTE] Using
addEventListener()onSVGSVGElementwill not work for theonXYZevent handlers listed below. Listen to the events on the {{domxref("window")}} object instead.
# symbol).Window.postMessage() from another browsing context.false.true.localStorage) has been modified in the context of another document.{{Specifications}}
{{Compat}}