MCPcopy Index your code
hub / github.com/CoderLine/alphaTab / parseHtml

Function parseHtml

packages/playground/src/util/Dom.ts:32–43  ·  view source on GitHub ↗
(markup: string)

Source from the content-addressed store, hash-verified

30}
31
32export 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
45export 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

Callers 15

constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected