Skip to content

Commit 42e2e27

Browse files
committed
Add comment explaining why this madness
1 parent f8e42a1 commit 42e2e27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/internal/dom.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ export function get_root_for_style(node: Node): ShadowRoot | Document {
155155
}
156156

157157
export function append_stylesheet(node: ShadowRoot | Document, style: HTMLStyleElement) {
158+
// For transitions to work without 'style-src: unsafe-inline' Content Security Policy,
159+
// these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API.
160+
// Using the hash for the empty string (for an empty tag) works in all browsers except Safari.
161+
// So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */.
162+
// The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari.
158163
style.textContent = style.textContent || '/* empty */';
159164
append((node as Document).head || node, style);
160165
return style.sheet as CSSStyleSheet;

0 commit comments

Comments
 (0)