SVGGElement in SVG 1.1

Corresponds to the <g> element for grouping together related graphics elements.

For more information see

Instance Properties

name type description
attributes NamedNodeMap (read only) [from Node]
childNodes NodeList (read only) [from Node]
className SVGAnimatedString (read only) [from SVGStylable]
externalResourcesRequired SVGAnimatedBoolean (read only) Does the element require external data to be loaded before it can be rendered? [from SVGExternalResourcesRequired]
farthestViewportElement SVGElement (read only) [from SVGLocatable]
firstChild Node (read only) [from Node]
id String [from SVGElement]
lastChild Node (read only) [from Node]
localName String (read only) [from Node]
namespaceURI String (read only) [from Node]
nearestViewportElement SVGElement (read only) [from SVGLocatable]
nextSibling Node (read only) [from Node]
nodeName String (read only) [from Node]
nodeType Number (read only) [from Node]
nodeValue String [from Node]
ownerDocument Document (read only) [from Node]
ownerSVGElement SVGSVGElement (read only) [from SVGElement]
parentNode Node (read only) [from Node]
prefix String [from Node]
previousSibling Node (read only) [from Node]
requiredExtensions SVGStringList (read only) [from SVGTests]
requiredFeatures SVGStringList (read only) [from SVGTests]
systemLanguage SVGStringList (read only) [from SVGTests]
tagName String (read only) [from Element]
transform SVGAnimatedTransformList (read only) Represents the transformation applied to this element. [from SVGTransformable]
viewportElement SVGElement (read only) [from SVGElement]
xmlbase String [from SVGElement]
xmllang String [from SVGLangSpace]
xmlspace String [from SVGLangSpace]

Instance Methods

name returns description
addEventListener(type,listener,useCapture) (none) [from EventTarget]
appendChild(newChild) Node [from Node]
cloneNode(deep) Node Return a new copy of the node. [from Node]
dispatchEvent(evt) Boolean Dispatches an event to the invoking object. [from EventTarget]
getAttribute(name) String [from Element]
getAttributeNode(name) Attr [from Element]
getAttributeNodeNS(namespaceURI,localName) Attr [from Element]
getAttributeNS(namespaceURI,localName) String [from Element]
getBBox() SVGRect Get the bounding box of the element. [from SVGLocatable]
getCTM() SVGMatrix Return the Current Transformation Matrix for the element. [from SVGLocatable]
getElementsByTagName(name) NodeList [from Element]
getElementsByTagNameNS(namespaceURI,localName) NodeList [from Element]
getPresentationAttribute(name) CSSValue [from SVGStylable]
getScreenCTM() SVGMatrix [from SVGLocatable]
getTransformToElement(element) SVGMatrix [from SVGLocatable]
hasAttribute(name) Boolean [from Element]
hasAttributeNS(namespaceURI,localName) Boolean [from Element]
hasAttributes() Boolean [from Node]
hasChildNodes() Boolean [from Node]
hasExtension(extension) Boolean [from SVGTests]
insertBefore(newChild,refChild) Node [from Node]
isSupported(feature,version) Boolean [from Node]
normalize() (none) [from Node]
removeAttribute(name) (none) [from Element]
removeAttributeNode(oldAttr) Attr [from Element]
removeAttributeNS(namespaceURI,localName) (none) [from Element]
removeChild(oldChild) Node [from Node]
removeEventListener(type,listener,useCapture) (none) [from EventTarget]
replaceChild(newChild,oldChild) Node [from Node]
setAttribute(name,value) (none) [from Element]
setAttributeNode(newAttr) Attr [from Element]
setAttributeNodeNS(newAttr) Attr [from Element]
setAttributeNS(namespaceURI,qualifiedName,value) (none) [from Element]


Grouping the elements together is useful for applying common styles to all contained elements, applying a common event handler to all child elements, or applying geometric transformations (such as a simple translation offset) to all elements at once. For example:
<g id="start" class="button" onclick="StartPlaying()" transform="translate(4cm,0cm)">
    <rect width="3cm" height="1cm" />
    <text x="1.5cm" text-anchor="middle" y="0.6cm">Start</text>