-
Notifications
You must be signed in to change notification settings - Fork 72
Spec doesn't clearly define onerror must be called if import map is added after the 1st module load #268
Comments
I'm unsure whether this is a bug report (i.e. the spec does not match the tests) or a request for increasing the spec's clarity. The intent of the quoted section is to be a non-normative summary of the normative requirements elsewhere. And I think it achieves that at a high level. It doesn't give the full normative details on what "not accepted" means; if you go read the parts of the spec that consult the "acquiring import maps" flag, then you see that it means an error event is fired and the resulting import map is not registered. But I think it's OK for such notes, like code comments in implementations, to not fully duplicate the "what". They can focus on the "why". But, if you found the note confusing, we can clarify it. And if you think the spec is just failing to properly reject import maps after the first module, then that's a bug and we should fix it! |
This is a request for increasing the spec's clarity. So the paragraph in Prepare a Script, is read to me like: But after reading the test in wpt of import maps, I realized I need to check the non-normative section of acquiring import maps as well, to find out that the boolean variable is also used to keep track of the first module load. And then onerror should be fired according to the spec So I have to check the spec back and forth, and also have to check how the test is written in wpt, to figure out the exact meanings. |
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
I believe this is fixed in whatwg/html#8075. Please check. If so, I will close this when I remove all spec text from this repository and instead let HTML be the new source of truth. |
Fixed in prepare the script element, Step 31.2.
|
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. See #8355. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. See #8355. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. See #8355. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. See #8355. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
This imports much of the specification from https://wicg.github.io/import-maps/. The main deltas are: * Does not include support for external import maps. This allows a good deal of simplification, such as by changing "acquiring import maps" + "pending import map script" + "wait for import maps" to a single "import maps allowed" boolean, or integrating "register an import map" into "execute the script element". If a src="" attribute is present on an importmap script element, then an error event is fired. See #8355. * Does not include any support for non-Window import maps. The spec draft included stub support for those, with other globals always having an empty import map. This instead ties import maps to Windows directly. If we revisit that in the future we can refactor, but keeping always-empty import maps around on the other globals was clumsy. * Adds introductory text and examples. * Adds conformance requirements, both on the script element and on the import map JSON. * Fixes a few minor specification issues: WICG/import-maps#267, WICG/import-maps#268, WICG/import-maps#270, WICG/import-maps#276, WICG/import-maps#277.
https://wicg.github.io/import-maps/#document-acquiring-import-maps
But it doesn't mention onerror must be called, or define what is 'accepted'
The error event is defined later in register an import map
But the registration is done in almost end of Prepare a script
Prepare a script (2) should have mentioned the error behavior when an import map is added after the 1st module load.
The text was updated successfully, but these errors were encountered: