Skip to content
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

Add minimize a supported MIME type for Fetch and Resource Timing #171

Merged
merged 3 commits into from
May 4, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion mimesniff.bs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,37 @@ confusion with the use of <i>media type</i> as described in <cite>Media Queries<
<p>A <a>MIME type</a> is <dfn export>supported by the user agent</dfn> if the user agent has the
capability to interpret a <a>resource</a> of that <a>MIME type</a> and present it to the user.

<p class=XXX>This needs more work. See
<p class=XXX>Ideally this would be more precise. See
<a href=https://github.com/w3c/preload/issues/113>w3c/preload #113</a>.

<div algorithm>
<p>To <dfn export>minimize a supported MIME type</dfn> given a <a>MIME type</a> <var>mimeType</var>,
run these steps. They return an <a>ASCII string</a>.

<ol>
<li><p>If <var>mimeType</var> is a <a>JavaScript MIME type</a>, then return
"<code>text/javascript</code>".

<li><p>If <var>mimeType</var> is a <a>JSON MIME type</a>, then return
"<code>application/json</code>".

<li><p>If <var>mimeType</var>'s <a for="MIME type">essence</a> is "<code>image/svg+xml</code>",
then return "<code>image/svg+xml</code>".
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li><p>If <var>mimeType</var> is an <a>XML MIME type</a>, then return
"<code>application/xml</code>".

<li><p>If <var>mimeType</var> is <a>supported by the user agent</a>, then return
<var>mimeType</var>'s <a for="MIME type">essence</a>.

<li><p>Return the empty string.
</ol>

<p class=note>The goal of this algorithm is to allow the caller to distinguish MIME types with
different processing models, such as those for GIF and PNG, but otherwise provide as little
information as possible.
</div>


<h3 id=mime-type-writing>MIME type writing</h3>

Expand Down