(markup: string)
| 30 | } |
| 31 | |
| 32 | export function parseHtml(markup: string): HTMLElement { |
| 33 | const t = document.createElement('template'); |
| 34 | t.innerHTML = markup.trim(); |
| 35 | const el = t.content.firstElementChild; |
| 36 | if (!(el instanceof HTMLElement)) { |
| 37 | throw new Error('parseHtml: template did not produce an HTMLElement'); |
| 38 | } |
| 39 | // <template>.content lives in an inert "template contents owner document" with no <head>. |
| 40 | // alphaTab and any other code that queries `ownerDocument` would see that inert doc — adopt |
| 41 | // the element into the main document so its ownerDocument is the page document. |
| 42 | return document.adoptNode(el); |
| 43 | } |
| 44 | |
| 45 | export function injectStyles(key: string, sheet: string): void { |
| 46 | // The DOM is the source of truth — keying off `data-cmp` rather than a module-level Set |
no outgoing calls
no test coverage detected