Document: rootElement property
DOM
DOM
The rootElement read-only property of the Document interface 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.