MDN self-hosted library · e01.org

Document: rootElement property

DOM

no runnable cells web-api-instance-property upstream source

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.

Specifications

Browser compatibility