[next] Place a target in the body (#1658)

This commit is contained in:
Andrea Giammarchi
2023-08-30 14:43:48 +02:00
committed by GitHub
parent 93539c9b5a
commit 0f2deeb71a
3 changed files with 17 additions and 2 deletions

View File

@@ -199,7 +199,11 @@ define("py", {
? queryTarget(target.value)
: document.createElement("script-py");
if (!hasTarget) element.after(show);
if (!hasTarget) {
const { head, body } = document;
if (head.contains(element)) body.append(show);
else element.after(show);
}
if (!show.id) show.id = getID();
// allows the code to retrieve the target element via