-
Notifications
You must be signed in to change notification settings - Fork 72
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
Specify aquiring import maps #136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work; thank you!!
A minor overall nit: can you match the rest of the spec in:
- Using
<div algorithm>
to wrap algorithms - Using two-space indent
- Not doing any manual line wrapping (instead using your text editor's line wrapping)?
spec.bs
Outdated
1. <p class="issue">Should we check whether the script element is moved | ||
across documents? | ||
Currently, we don't check that and the import maps are always registered | ||
to the settings object at the time of prepare-a-script.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have both had a long-running TODO to tighten up the current spec and implementation on this.
If possible, it would be good to implement our latest preferred approach for import maps from the beginning. I don't know whether that's possible without refactoring a lot of the existing spec, though. I remember when we tried previously we discovered we needed more refactoring, and that may apply here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check for moving between documents, and add a link to the spec PR whatwg/html#2673 for other script cases.
I feel this PR is not strongly blocked by #2673, as we can amend the the condition here later according to the future discussion on #2673.
Thank you for review! I reflected some of comments, and will address the rest later.
Is there any formatting tool (e.g. something clang-format-like) for bikeshed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good. If you can fix the wrapping, I can probably tidy up any minor issues and land.
Updated the PR. I tried to move Also fixed wait for import maps (6e71eb2). Remaining TODO is to fix links to HTML specs (e.g. |
I will try moving this all to Document, since this acquiring stuff is Document-specific, i.e. we will probably use a different mechanism in workers. |
Moving it to Document is too hard because the module script fetching algorithms are all agnostic to document vs. worker. I guess it is OK as-is for now, although it is a bit strange to put state directly on environment settings objects. We can try to figure out a better solution later perhaps. I pushed minor editorial fixes, but it mostly looks good to me now! The only remaining issue I have is that I do not understand the second warning, that says
Can you expand (just on GitHub is fine) with an example? I'm not sure, for example, where I'd like to get that cleared up before merging since I don't want to have text in the spec I don't understand :). |
… maps flag is false, and clear acquiring import maps flag before spin the event loop
I digged more into this and found that:
So
Probably it's good to land this PR with the second warning removed, and file a github issue about this. |
Thanks for explaining! I will reword the note a bit. I don't think it's a big deal to have this inconsistency because import() is so different (operating on specifiers instead of URLs). |
This PR the semantics around "aquiring import maps", including
how import maps are loaded via <script> elements, and
how import map loading and module script loading interact and block each other.
Preview | Diff