▲ | jfagnani 2 days ago | ||||||||||||||||
No. I would use <script type="-json"> <script> parses its contents as text, whereas <template> parses as DOM. This means you don't have to escape `<`, just `</script>`. Myself and some browser engineers been working on proposals to allow for inline modules, including JSON, that are importable into other modules via regular import statements. This is why I recommend the "-json" type - so it doesn't collide with a future native "json" type. | |||||||||||||||||
▲ | SahAssar 2 days ago | parent | next [-] | ||||||||||||||||
Why not use a somewhat proper mime type like `<script type="application/mytype+json">` or similar? Seems like your suggestion is not what the spec recommends: https://html.spec.whatwg.org/multipage/scripting.html#attr-s... | |||||||||||||||||
| |||||||||||||||||
▲ | alserio 2 days ago | parent | prev [-] | ||||||||||||||||
Thank you. And that proposal seems really interesting. Can I ask for a link if you happen to have one publicly accessible? |