Skip to content

Commit

Permalink
Add minimize a supported MIME type for Fetch and Resource Timing
Browse files Browse the repository at this point in the history
See WebKit/standards-positions#88 (comment) for rationale. whatwg/fetch#1481 will be updated to call this.
  • Loading branch information
annevk committed Apr 27, 2023
1 parent ca4f6b8 commit a720e70
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion mimesniff.bs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,35 @@ 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>.

<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>".

<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.


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

Expand Down

0 comments on commit a720e70

Please sign in to comment.