[next] allow document.createElement(py-script) (#1662)

This commit is contained in:
Andrea Giammarchi
2023-08-31 14:23:01 +02:00
committed by GitHub
parent 74cd7c840a
commit 4cc9647dc6
3 changed files with 49 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<style>py-script{display:none}</style>
<script type="module" src="../core.js"></script>
<script type="module">
customElements.whenDefined('py-script').then(PyScript => {
const textContent = `
from pyscript import display
display("Hello World")
`;
document.body.append(
// test <script type="py">
Object.assign(
document.createElement('script'),
{ type: "py", textContent }
),
// test <py-script>
Object.assign(
document.createElement('py-script'),
{ textContent }
),
// test PyScript class
Object.assign(
new PyScript(),
{ textContent }
)
);
});
</script>
</head>
</html>