-
Notifications
You must be signed in to change notification settings - Fork 45
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
[task] milestone 0: <script type="module"> #83
Comments
While implementing the prototype, I have encountered the issue, How "charset" / "crossorigin" attributes are handled? For example, there are tags that finally load the same module. <script type="module" charset="euc-jp" src="A.js"></script>
<script type="module" charset="utf-8" src="B.js"></script>
In the above case, which One idea I think is that, inserting the originator(tag)'s attributes to the module key. |
jajaja, I don't know, but I'm glad that you're raising this issue. Let me circle this back to other folks and see what we can do. |
In theory (based on the conversation we had today), a and b will be raising (due to the network activity). a, and b will be also compiled (looking for deps), whichever raises to the completion of the fetch process will issue a fetch for c. This seems to be a real problem, I'm adding |
We should not allow charset, and always interpret as utf8, like workers do. |
How about edit: |
+1 on that jajaja. If we can settle on that, I can add the corresponding wording into the spec. @domenic, link to that piece in the workers' spec? or any discussion related to this topic in the context of the worker? |
And I'm also +1 on utf-8. The module will be rewritten from the old code because it includes non compat syntax and semantics. It's good time to require utf-8. |
just to clarify my position: my +1 was on the utf8 comment from @domenic |
Is it necessary to wait page load completion? How about |
right, I should have clarified about the whole question including async/defer. I will add more notes about this tomorrow when I get home. GH mobile is very restrictive. |
@caridy: |
We should get @annevk to help with deciding on For For a reference on workers, see worker processing model, step 6. Although, I am wondering why we are allowing |
One problem with |
I think CORS is a must since otherwise we have new SOP holes. "anonymous" seems like the best default. Perhaps it can be |
|
Yes, we would fix HTML. In fact presumably most of |
Is improving the existing |
@okuryu by using |
@annevk Aha, good point! Thanks for your clarification. |
Nice catch! If we allow |
If |
The other aspect of this is backward compatibility. We have discussed in the past that maybe we can have a way to detect support for modules at the server side (using accept header), which opens the possibility of using note: I'm just trying to record all the ideas we have discussed in the past. |
I think the minimal solution consists of one of two possibilities:
Anything on top of these proposals, up to a full-fledged src attribute and/or import attribute and/or inline body combo, seems strictly more than minimal. I'd suggest pursuing a minimal strategy for now. (2) seems best. |
Agree that (2) is way more simple, and I will be happy to pursue it. As far as I can tell, using: <script type="module">
import "foo";
</script> will be completely ignored today, which means detection and polyfills can be implemented. |
I do think there is value in providing both (1) and (2) here, as they cater for different use cases. Inline script is useful, but is disabled by CSP. Loading a single main entry point is a very common use case, so having its own property makes sense both to support CSP and as sugar: <script type="module" import="foo"> |
@guybedford you can have inline script and CSP using the nonce attribute. |
right, but I think @guybedford has a point here, adding the nonce is extra complexity compared to the old mighty script tag with src :) |
If you do anymore than inline you'll have the |
Related notes from the discussion during last week meeting: Script Tags:
Configuring Loader:
|
Other than this bug, is there a rough spec of |
@dglazkov no, we are looking for help on this :) |
@caridy I might be able to whip something up... I recently re-did HTML's script loading and evaluation to match ES's new semantics, so I understand the issues pretty well. The experience also confirmed my suspicions that this will be pretty intimately tied to HTML, and so probably better as a PR to HTML than as part of the loader spec; that the loader spec can continue its focus on reflective modules and configurable policies. I'll ping you when I have something to review :) |
@domenic 💯 |
🙌 🚢 🎄 |
Is the current thinking still that this will contain a body that is a module and not a |
I think I can manage both actually; it's almost more work to prohibit one or the other, given how HTML currently specifies |
notes:
<script type="module">
tagsThe text was updated successfully, but these errors were encountered: