mirror of
https://github.com/Davilarek/Vencord.git
synced 2025-05-10 17:35:41 +02:00
Add parseHTML
This commit is contained in:
parent
13ca3bce09
commit
9fbc5a2b6e
1 changed files with 9 additions and 0 deletions
|
@ -792,6 +792,15 @@ export const DOMHolder = {
|
|||
if (theRemoteScript != null)
|
||||
theRemoteScript.remove();
|
||||
},
|
||||
parseHTML(html: string, asFragment = false) {
|
||||
const template = document.createElement("template");
|
||||
template.innerHTML = html.trim();
|
||||
if (asFragment) {
|
||||
return template.content.cloneNode(true);
|
||||
}
|
||||
const { childNodes } = template.content;
|
||||
return childNodes.length === 1 ? childNodes[0] : childNodes;
|
||||
},
|
||||
};
|
||||
|
||||
class DOMWrapper {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue