-
Notifications
You must be signed in to change notification settings - Fork 27
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
Inferring module type from MIME type vs type
attribute needs clarification
#140
Comments
Actually looking at WICG/webcomponents#839 and whatwg/html#7233 side-by-side, shouldn't security-mandated attributes just be true to purpose and look like this? import foo from "./foo.css" with { csp: "style-src" };
// or
import foo from "./foo.css" with { csp: "weak" };
import bar from "./bar.json" with { csp: "weak" }; |
What would happen on the web after whatwg/html#7233 is that The reason that this proposal has been changed even after reaching stage 3 is that what HTML needs/wants is not just an assertion. I think it's good to consider more possible import attributes, but at this point that discussion better fits in the HTML repo than here. |
Thanks for the reply. I'm using the word "assertion" imprecisely and perhaps the name But the distinction I'm talking about is the intended purpose of the The documentation here, written under the assumption of |
The syntax has changed; its now “with” instead of “assert”. |
@ljharb Yeah this issue is after that, could you elaborate on your point? |
@nayeemrmn ah sorry, i misread your comment. You're saying that the docs need to improve. |
This issue is too broad to keep open. But basically my thought was that it would be appropriate for https://github.com/tc39/proposal-import-attributes/blob/cf907580dc890f3d0329a4376368c8f845260fdb/README.md#proposed-semantics-and-interoperability to actively suggest that |
This is regarding the explained purpose of the
type
attribute -- not attributes in general.With the
assert
syntax it was obvious that the type of module is ultimately inferred from the MIME header or whatever the host decides, and the assertedtype
wouldn't change behaviour of the program except to error or not.However with the
with
syntax, it's not so obvious anymore. But from what I understand and based on https://github.com/tc39/proposal-json-modules which is still stage 3, it's still the case that thetype
attribute generally doesn't alter non-errant behaviour and the module type is still absolutely determined from the mime type.Is that correct? Then it would be weird if hosts started using the same attribute key for things which do alter behaviour, instead of just exploring other keys like
{ type: "image", as: "canvas"}
. I think it should still be strongly discouraged.So then... should thetype
attribute be renamed toassertType
or something to better indicate that? This would require a breaking change / demotion to https://github.com/tc39/proposal-json-modules as well.Related issue:
type: "any"
#116 - Imaginewith { type: "any" }
vswith { assertType: "any" }
.The text was updated successfully, but these errors were encountered: