此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

Document:rootElement 属性

Deprecated

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

Document.rootElement 返回 document 的根元素,如果它是 <svg> 元素,则返回该元素;否则返回 null。它已被弃用,建议采用适用于获取所有文档的根元素的 Document.documentElement 属性。

对于 SVG 元素,返回 document 的根元素;否则返回 null

如果文档是一个非空的 SVG 文档,那么 rootElement 将是与 documentElement 相同的 SVGSVGElement

规范

规范
Scalable Vector Graphics (SVG) 2
# InterfaceDocumentExtensions

浏览器兼容性