Skip to content

Commit aa2a55c

Browse files
committed
fix: safer element creation
Creating divs from document.body instead of document.
1 parent 23efe36 commit aa2a55c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function generate(app: App,
3838
break;
3939
}
4040
default: {
41-
div = document.createDiv();
41+
div = document.body.createDiv();
4242
}
4343
}
4444

@@ -133,7 +133,7 @@ async function renderCM(
133133
await delay(500);
134134

135135
const contentDiv = view.contentEl.querySelector(".cm-content.cm-lineWrapping");
136-
const tempDiv = document.createElement("div");
136+
const tempDiv = document.body.createDiv();
137137
tempDiv.className = "markdown-source-view mod-cm6 is-live-preview";
138138

139139
tempDiv.innerHTML = contentDiv ? contentDiv.innerHTML : "";

0 commit comments

Comments
 (0)