-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html/template: add support for JavaScript modules #31327
Comments
So, a couple of thoughts on this: The only difference is for import statements. Those will likely need to sanitize the string as script src AND javascript string. @mikesamuel do you have more context on JS modules differences with normal scripts? |
@empijei There's no significant difference. func isJSType(mimeType string) bool {
...
switch mimeType {
case
"application/ecmascript",
...
}
...
} |
The only reason I created this issue is that I was asked to create it in addition to the merge request I already created: #27697. And yes, it does add a single line to this function. |
@tomuta, thanks for explaining. Now I see https://go-review.googlesource.com/c/go/+/135417 |
This is a good point, and there're module expressions: |
It sounds like we should do this (and accept CL 135417 once it is reviewed). |
Change https://golang.org/cl/135417 mentions this issue: |
Change https://golang.org/cl/175218 mentions this issue: |
template/html does not properly treat javascript code as javascript when using a
<script type="module"
tag:What did you expect to see?
What did you see instead?
See also: https://www.w3.org/TR/html5/semantics-scripting.html#element-attrdef-script-type
I created a pull request that fixes the issue: #27697
The text was updated successfully, but these errors were encountered: