Comments (8)
there is only one tag you can't have within a <script>
and that's </script>
... because it closes the opening one.
This is not PyScript, this is how Web standards work and the only caveat around data elements (namely: script
).
If you change that huge triple quoted string at the very end using <\x2fscript>
instead of </script>
nothing different should happen.
The \x2f
char represents /
but it doesn't bother the browser as that's just code within a code related tag.
Bear in mind injecting scripts via strings is XSS error prone and it might even be disabled by browsers + keep in mind you cannot inject whole pages into an element ... elements are not iframes so expect issues (due Web standars) there too.
This is impossible to fix code-wise because we don't get to change the browser parsing behavior here.
from pyscript.
Closing as there's no follow-up action from our side, beside eventually documenting this but nothing we can ever fix.
If you have any follow up question, feel free to ask.
from pyscript.
To whom it might concern, this is issue is the equivalent of:
<script>
console.log(`
<script>nope</script>
`);
</script>
That cannot work on the Web, but this can:
<script>
console.log(`
<script>nope<\x2fscript>
`);
</script>
You can see even GitHub highlighter goes bananas with the former example.
from pyscript.
Indeed it still works this way.
https://_12.pyscriptapps.com/soft-paper/latest/
from pyscript.
@nasrin1748 your example uses an external file ... that never interferes with the parsing of the DOM within the browser.
Please note that this is not an opinion of mine, this is how the Web standards work.
If you write </script>
inside a <script></script>
tag and that's not the closing tag you will have errors in a way or another. The script is indeed meant as non-processing node/instruction and it ignores everything until the closing tag.
If you were referring to something else like putting a DOCTYPE node with html and body inside a <div>
I am telling you that's not doing what you think it's doing ... and this is also defined by Web standards.
If you need any other clarification feel free to ask.
from pyscript.
P.S. to explain further the issue, it's the exact same with multi line coments:
/**
* if you put */ here that's it
*/
See the broken highlight or try it in any JS, C, or any other PL context and see the result is not what you meant.
from pyscript.
Do ipywidgets work in pyscript?
from pyscript.
we have a discord channel for questions related to PyScript. Let's please not discuss unrelated topics in here so that others might read or answer without needing to read into unrelated issues, thank you!
from pyscript.
Related Issues (20)
- In the code editor ctrl+enter does not create a new line below HOT 3
- `PyDom[key: int]` raises `AttributeError: 'int' object has no attribute 'indices'`
- Terminal does not show error message when using workers HOT 2
- Py Terminal issues aggregation HOT 1
- PyScript pre-resolved config URL is not consistent
- the py-editor is created repeatedly HOT 13
- MicroPython doesn't support MethodType() from "types" module! HOT 1
- MicroPython doesn't support alternative syntax to create a tuple outta comprehension HOT 1
- MicroPython should provide better error messages for missing APIs HOT 8
- Alert box issue. HOT 3
- Error message not shown. HOT 6
- terminal with worker not working HOT 2
- Saved Image not Displayed. HOT 4
- Incorrect line number in exception tracebacks HOT 18
- UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' when using pyscript 2024.1.3 HOT 15
- nltk data download error HOT 1
- Unable to upload pdf file. HOT 1
- Unable to upload .mp4 file. HOT 1
- Cannot create a PyWorker from python using Pyodide HOT 8
- Improve either PyWorker documentation or internals in general HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyscript.