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 # dom-shadowroot-mode |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
mode |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.