We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS


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


ShadowRoot.mode 只读
ShadowRoot 的模式:是 "open" 或者 "closed".
ShadowRoot 的模式(mode) 设置为 "closed" 会让该 ShadowRoot 的内部实现无法被 JavaScript 访问及修改 — 也就是说将该实现不公开,例如,<video> 标签内部实现无法被 JavaScript 访问及修改。
ShadowRoot.host 只读
ShadowRoot 附加的宿主DOM元素。
ShadowRoot 内部的DOM树。


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


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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.


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