fix: trustedTypes issue

- Close #2339
This commit is contained in:
JellyBrick
2024-10-16 20:40:35 +09:00
parent 11b11ed966
commit 9bc42f836f
5 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,7 @@
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;
template.innerHTML = window.trustedTypes?.defaultPolicy ? window.trustedTypes.defaultPolicy.createHTML(html) : html;
return template.content.firstElementChild as HTMLElement;
};