MDN’s new design is in Beta! A sneak peek:


Shadow DOM API的 ShadowRoot接口是一个DOM子树的根节点, 它与文档的主DOM树分开渲染。


ShadowRoot.mode 只读
The mode of the ShadowRoot: either "open" or "closed".
Setting the mode of a shadow root to "closed" makes the shadow root’s implementation internals inaccessible and unchangeable from JavaScript—in the same way the implementation internals of, for example, the <video> element are inaccessible and unchangeable from JavaScript. 只读
A DOM element to which the ShadowRoot is attached.
The DOM tree inside the ShadowRoot.


Specification Status Comment
Interface ShadowRoot
Living Standard  
Shadow DOM
the ShadowRoot interface
Working Draft Initial definition.


Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 53 未实现[1] 未实现[2] 未实现 40 10
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 53 未实现[1] 未实现[2] 未实现 40 10.1

[1] This feature is not implemented yet. See the Edge platform status.

[2] This feature is implemented behind the preference dom.webcomponents.enabled, defaulting to false. See bug 1205323.


 此页面的贡献者: xgqfrms-GitHub, Sebastianz
 最后编辑者: xgqfrms-GitHub,