Skip to content

Commit

Permalink
SAK-50741 Webcomponents fix Chrome warning import rules are not allow…
Browse files Browse the repository at this point in the history
…ed here (#13090)
  • Loading branch information
ottenhoff authored Dec 6, 2024
1 parent bb4fcf7 commit 0ffe68c
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { css, unsafeCSS } from "lit";

let globalSheets = null;

export function getGlobalStyleSheets() {
if (globalSheets === null) {
globalSheets = Array.from(document.styleSheets)
.map(x => {
const sheet = new CSSStyleSheet();
const css = Array.from(x.cssRules).map(rule => rule.cssText).join(" ");
sheet.replaceSync(css);
return sheet;
const cssText = Array.from(x.cssRules)
.filter(rule => rule.constructor.name !== "CSSImportRule")
.map(rule => rule.cssText)
.join(" ");
return css`${unsafeCSS(cssText)}`;
});
}

Expand Down

0 comments on commit 0ffe68c

Please sign in to comment.