ShadowRoot.mode
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
mode
是 ShadowRoot
的只读属性,它返回 ShadowRoot
创建时的模式 ("open
" 或者 "closed
") 。
当 ShadowRoot
的 mode
是 "closed
" 时, ShadowRoot
的内部实现无法被 JavaScript 访问及修改 — 也就是说将该实现不公开,例如,<video>
标签内部实现无法被 JavaScript 访问及修改。
Syntax
var mode = shadowRoot.mode
Value
值为 "open
" 或者 "closed
".
Specifications
Specification |
---|
DOM Standard # dom-shadowroot-mode |
Browser compatibility
BCD tables only load in the browser