mirror of https://github.com/sveltejs/svelte
When Svelte components inject `<style>` elements at runtime via `append_styles`, these elements now inherit the CSP nonce from any existing nonce-bearing element on the page. This allows them to pass CSP checks when a `style-src 'nonce-...'` policy is in effect. Browsers expose `element.nonce` to JavaScript while hiding it from CSS selectors, so querying `[nonce]` and reading `.nonce` is safe and works correctly. Fixes #14270 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>pull/17776/head
parent
69e6c4cdbb
commit
53e5fa491a
Loading…
Reference in new issue