We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1a7cf7d commit d95723bCopy full SHA for d95723b
passShadowDom
@@ -0,0 +1,13 @@
1
+/**
2
+ * Takes a node, CSSResult and appends it
3
+ */
4
+export const applyStyle = (node: LitElement, style: CSSResult) => {
5
+ if ("adoptedStyleSheets" in document) {
6
+ const sheets = node.shadowRoot.adoptedStyleSheets;
7
+ node.shadowRoot.adoptedStyleSheets = [...sheets, style._styleSheet];
8
+ } else {
9
+ const styleNode = document.createElement("style");
10
+ styleNode.textContent = style.cssText;
11
+ node.shadowRoot.appendChild(styleNode);
12
+ }
13
+};
0 commit comments