非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!

备注: This API is available only to WebExtensions.

Element.openOrCloseShadowRoot 是一个只读属性。represents the shadow root hosted by the element, regardless if its mode is open or closed. Use Element.attachShadow() to add a shadow root to an existing element.


var shadowroot = element.shadowRoot;


A ShadowRoot object instance, regardless if its mode is set to open or closed, or null if no shadow root is present. (See Element.attachShadow() for further details).


This property is not part of any specification.

Browser compatibility

BCD tables only load in the browser

See also