Document: rootElement property

Deprecated

Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.

Document.rootElement returns the Element that is the root element of the document if it is an <svg> element, otherwise null. It is deprecated in favor of Document.documentElement, which returns the root element for all documents.

Value

For SVG elements, the Element that is the root element of the document; otherwise null.

If the document is a non-empty SVG document, then the rootElement will be an SVGSVGElement, identical to the documentElement.

Specifications

Specification
Scalable Vector Graphics (SVG) 2
# InterfaceDocumentExtensions

Browser compatibility