Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Parsable MIME type is going away#113

Closed
annevk opened this issue Oct 9, 2017 · 10 comments · Fixed by whatwg/html#7851
Closed

Parsable MIME type is going away #113

annevk opened this issue Oct 9, 2017 · 10 comments · Fixed by whatwg/html#7851

Comments

@annevk
Copy link
Member

annevk commented Oct 9, 2017

In whatwg/mimesniff#36 I'm changing some of the fundamentals around MIME types. It'll be called a "MIME type" or "MIME type record" now.

I'm also not super happy about the term "supported by the user agent" which I think Preload is the only consumer of:

  1. It's overly generic and not clear it applies to just MIME types.
  2. The definition leaves a lot to be desired. Is text/javascript supported?
@yoavweiss
Copy link
Contributor

The processing of type with <link rel=preload> should not differ from the processing of type in <picture><source></picture>.
Looking at https://html.spec.whatwg.org/multipage/images.html#updating-the-source-set (step 4.8) it seems to be the case. (HTML just doesn't point at the definition of "supported MIME type" but to "MIME type" itself)

I'll be happy to switch preload (as well as HTML's image processing) to any definition of that term that you prefer.

@annevk
Copy link
Member Author

annevk commented Oct 9, 2017

So you just want to match <picture>? What about <video><source>? What about text/html?

@yoavweiss
Copy link
Contributor

The reason I brought up <picture> is because that's the one I know requires similar hooks. You're right that <video><source> is similar, and it seems to be using "a type that the user agent knows it cannot render", which would also fit the bill if defined in a way that is not media specific.

What about text/html?

I'm not sure what you mean by that. Can you elaborate?

@annevk
Copy link
Member Author

annevk commented Oct 10, 2017

I think I still don't understand your requirements. What <picture> and <video> need seems much more limited. Again, in OP I brought up text/javascript, which isn't typically seen by the user. Is that something you might preload? I'd think so.

@yoavweiss
Copy link
Contributor

I don't think there's a true use case to avoid loading <link rel=preload as=image type="text/javascript"> or the like. The important thing with type is to avoid loading resources that the UA does not support at all. Is this the part that wasn't clear to you about the requirements for preload? Or is it something else?

As an aside, it's not clear to me from updating the source set algorithm what should be done with e.g. <picture><source srcset=foo type="text/javascript"><img></picture>.

@annevk
Copy link
Member Author

annevk commented Oct 12, 2017

That's probably a good bug to file against "updating the source set".

I was just asking since the current text talks about being able to interpret the resource and present it. But we support some types we don't really present as well. And yeah, type being used with a value that doesn't match as is confusing too. The text should probably clarify that type is being used as a boolean check irrespective of other attributes (or we need to define something more detailed).

@domenic
Copy link
Contributor

domenic commented Oct 13, 2017

Why would "parseable MIME type" go away? I think it'd be any string/byte sequence for which https://mimesniff.spec.whatwg.org/branch-snapshots/annevk/mime-type/#parse-a-mime-type does not return failure.

@annevk
Copy link
Member Author

annevk commented Oct 13, 2017

I don't think that's a useful thing to have similar to how not having a "parseable URL" is fine. You parse something and then you use it for all kinds of things. You don't continue parsing it for use in a conditional.

@yoavweiss
Copy link
Contributor

yoavweiss commented Oct 15, 2018

@annevk getting back to this. IIUC, what we need here (other than changing the link from "parsable mime type" to "mime type") is to redefine "supported by the user agent" in a way that's not tied to presentation. Does that match your understanding?

@annevk
Copy link
Member Author

annevk commented Oct 16, 2018

I think it also needs to be made clearer when type is involved in the decision making process and how the user agent is to react to different values. E.g., if Chrome were to preload <link rel=preload as=image type=text/javascript>, but Firefox would not, and the specification were to allow either, I think there's a problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@domenic @yoavweiss @annevk and others