mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
9 lines
335 B
TypeScript
9 lines
335 B
TypeScript
// Creates a DOM element from an HTML string
|
|
export const ElementFromHtml = (html: string): HTMLElement => {
|
|
const template = document.createElement('template');
|
|
html = html.trim(); // Never return a text node of whitespace as the result
|
|
template.innerHTML = html;
|
|
|
|
return template.content.firstElementChild as HTMLElement;
|
|
};
|