mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-13 07:01:00 -05:00
[next] Place a target in the body (#1658)
This commit is contained in:
committed by
GitHub
parent
93539c9b5a
commit
0f2deeb71a
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
11
pyscript.core/test/target.html
Normal file
11
pyscript.core/test/target.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="module" src="../core.js"></script>
|
||||
<script type="py">
|
||||
from pyscript import display
|
||||
|
||||
display('hello\nworld')
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
Reference in New Issue
Block a user