adoptedStyleSheets property
The adoptedStyleSheets
property of the ShadowRoot interface sets
an array of constructed stylesheets to be used by the shadow DOM subtree.
Note: A constructed stylesheet is a stylesheet created programmatically using the
CSSStyleSheet()
constructor (as compared to one created by a user-agent when importing a stylesheet from a script, imported usingstyle
and , or linked to vialink
).
The same constructed stylesheet can be adopted by multiple ShadowRoot instances, and by the parent document (using the Document.adoptedStyleSheets property). Changing an adopted stylesheet will affect all the adopting objects.
Stylesheets in the adoptedStyleSheets
property are considered along with
the shadow DOM's other stylesheets.
For the purpose of determining the final computed CSS of any element, they
are considered to have been added after the other stylesheets in the
shadow DOM
(ShadowRoot.styleSheets
).
Only stylesheets created using the CSSStyleSheet()
constructor,
and from within the same parent Document as the shadow root, may be
adopted.
Implementation
external JSArray<CSSStyleSheet> get adoptedStyleSheets;
Implementation
external set adoptedStyleSheets(JSArray<CSSStyleSheet> value);