//@ts-check /** * Generates valid dom elements from a string * @param {string} htmlString */ export const generateDomFromString = (htmlString) =>{ const children = new DOMParser().parseFromString(`
${htmlString}
`, "text/html") .children const fragment = document.createDocumentFragment() fragment.append(...children) return fragment ;} export default generateDomFromString;