Skip to content

Commit 37659e9

Browse files
Use appropriate fetch destination for CSS & JSON modules
Builds on whatwg/fetch#1691. Tests: web-platform-tests/wpt#41665. Fixes whatwg#7233.
1 parent 0a829aa commit 37659e9

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

source

+21-1
Original file line numberDiff line numberDiff line change
@@ -27288,6 +27288,9 @@ document.body.appendChild(wbr);</code></pre>
2728827288
<li><p><var>destination</var> is "<code data-x="">font</code>" and
2728927289
<var>mimeTypeRecord</var> is a <span>font MIME type</span>;</p></li>
2729027290

27291+
<li><p><var>destination</var> is "<code data-x="">json</code>" and
27292+
<var>mimeTypeRecord</var> is a <span>JSON MIME type</span></p>;</li>
27293+
2729127294
<li><p><var>destination</var> is "<code data-x="">style</code>" and
2729227295
<var>mimeTypeRecord</var>'s <span data-x="MIME type essence">essence</span> is
2729327296
<code>text/css</code>; or</p></li>
@@ -104824,11 +104827,14 @@ document.querySelector("button").addEventListener("click", bound);
104824104827

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

104834+
<li><p>Set <var>request</var>'s <span data-x="concept-request-destination">destination</span> to
104835+
the result of running the <span>fetch destination from module type</span> steps given
104836+
<var>destination</var> and <var>moduleType</var>.</p></li>
104837+
104832104838
<!--
104833104839
"serviceworker" being included here is not redundant with the Service Worker spec's own
104834104840
same-origin check, because the request's mode also affects the Origin and Sec-Fetch-Mode
@@ -105243,6 +105249,20 @@ document.querySelector("button").addEventListener("click", bound);
105243105249
<li><p>Return true.</p></li>
105244105250
</ol>
105245105251

105252+
<p>The <dfn>fetch destination from module type</dfn> steps, given a <span
105253+
data-x="concept-request-destination">destination</span> <var>defaultDestination</var> and a
105254+
<span>string</span> <var>moduleType</var>, are as follows:</p>
105255+
105256+
<ol>
105257+
<li>If <var>moduleType</var> is "<code data-x="">json</code>", then return "<code
105258+
data-x="">json</code>".</li>
105259+
105260+
<li>If <var>moduleType</var> is "<code data-x="">css</code>", then return "<code
105261+
data-x="">style</code>".</li>
105262+
105263+
<li>Return <var>defaultDestination</var>.</li>
105264+
</ol>
105265+
105246105266
<h5 id="calling-scripts">Calling scripts</h5>
105247105267

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

0 commit comments

Comments
 (0)