mode property

ShadowRootMode get mode

The mode read-only property of the ShadowRoot specifies its mode — either open or closed. This defines whether or not the shadow root's internal features are accessible from JavaScript.

When the mode of a shadow root is "closed", the shadow root's implementation internals are inaccessible and unchangeable from JavaScript—in the same way the implementation internals of, for example, the video element are inaccessible and unchangeable from JavaScript.

The property value is set using the options.mode property of the object passed to Element.attachShadow, or using the shadowrootmode attribute of the <template> element when a shadow root is created declaratively.

Implementation

external ShadowRootMode get mode;