Daniel Bates 1 day ago committed by GitHub
commit ef1b12acd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -23,6 +23,13 @@ export function append_styles(anchor, css) {
style.id = css.hash;
style.textContent = css.code;
// Propagate nonce to the style element for CSP compliance.
// Browsers allow reading `element.nonce` from JS but hide it from CSS selectors,
// so we can find a nonce from any existing script/style element on the page.
var doc = /** @type {Document} */ (/** @type {ShadowRoot} */ (root).host ? root.ownerDocument : root);
var nonce = /** @type {HTMLElement | null} */ (doc?.querySelector('[nonce]'))?.nonce;
if (nonce) style.nonce = nonce;
target.appendChild(style);
if (DEV) {

Loading…
Cancel
Save