(document: Document, css: string)
| 291 | } |
| 292 | |
| 293 | export function setStyleSheet(document: Document, css: string): void { |
| 294 | const existing = findStyleElement(document); |
| 295 | if (!css) { |
| 296 | existing?.remove(); |
| 297 | return; |
| 298 | } |
| 299 | let el = existing; |
| 300 | if (!el) { |
| 301 | el = document.createElement("style") as unknown as Element; |
| 302 | const head = |
| 303 | (document.querySelector("head") as unknown as Element | null) ?? |
| 304 | (document.body as unknown as Element); |
| 305 | (head as any).appendChild(el); |
| 306 | } |
| 307 | el.textContent = css; |
| 308 | } |
| 309 | |
| 310 | // ─── GSAP script helpers ────────────────────────────────────────────────────── |
| 311 |
no test coverage detected