feat: refactor plugin utils (#1391)

This commit is contained in:
JellyBrick
2023-11-09 11:06:06 +09:00
committed by GitHub
parent 269352af97
commit 47cccbce7c
31 changed files with 68 additions and 65 deletions

View 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;
};

View File

@ -0,0 +1 @@
export * from './html';