Skip to content

Commit

Permalink
Use appropriate fetch destination for CSS & JSON modules
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo authored Oct 29, 2023
1 parent 0a829aa commit 37659e9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion source
Original file line number Diff line number Diff line change
Expand Up @@ -27288,6 +27288,9 @@ document.body.appendChild(wbr);</code></pre>
<li><p><var>destination</var> is "<code data-x="">font</code>" and
<var>mimeTypeRecord</var> is a <span>font MIME type</span>;</p></li>

<li><p><var>destination</var> is "<code data-x="">json</code>" and
<var>mimeTypeRecord</var> is a <span>JSON MIME type</span></p>;</li>

<li><p><var>destination</var> is "<code data-x="">style</code>" and
<var>mimeTypeRecord</var>'s <span data-x="MIME type essence">essence</span> is
<code>text/css</code>; or</p></li>
Expand Down Expand Up @@ -104824,11 +104827,14 @@ document.querySelector("button").addEventListener("click", bound);

<li><p>Let <var>request</var> be a new <span data-x="concept-request">request</span> whose
<span data-x="concept-request-url">URL</span> is <var>url</var>, <span
data-x="concept-request-destination">destination</span> is <var>destination</var>, <span
data-x="concept-request-mode">mode</span> is "<code data-x="">cors</code>", <span
data-x="concept-request-referrer">referrer</span> is <var>referrer</var>, and <span
data-x="concept-request-client">client</span> is <var>fetchClient</var>.</p></li>

<li><p>Set <var>request</var>'s <span data-x="concept-request-destination">destination</span> to
the result of running the <span>fetch destination from module type</span> steps given
<var>destination</var> and <var>moduleType</var>.</p></li>

<!--
"serviceworker" being included here is not redundant with the Service Worker spec's own
same-origin check, because the request's mode also affects the Origin and Sec-Fetch-Mode
Expand Down Expand Up @@ -105243,6 +105249,20 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>Return true.</p></li>
</ol>

<p>The <dfn>fetch destination from module type</dfn> steps, given a <span
data-x="concept-request-destination">destination</span> <var>defaultDestination</var> and a
<span>string</span> <var>moduleType</var>, are as follows:</p>

<ol>
<li>If <var>moduleType</var> is "<code data-x="">json</code>", then return "<code
data-x="">json</code>".</li>

<li>If <var>moduleType</var> is "<code data-x="">css</code>", then return "<code
data-x="">style</code>".</li>

<li>Return <var>defaultDestination</var>.</li>
</ol>

<h5 id="calling-scripts">Calling scripts</h5>

<p>To <dfn export>run a classic script</dfn> given a <span>classic script</span> <var>script</var>
Expand Down

0 comments on commit 37659e9

Please sign in to comment.