mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
feat: refactor plugin utils (#1391)
This commit is contained in:
8
src/plugins/utils/renderer/html.ts
Normal file
8
src/plugins/utils/renderer/html.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// 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;
|
||||
};
|
||||
Reference in New Issue
Block a user