Skip to content

Commit 8cdd137

Browse files
Updating steps and fixing error
1 parent aeca132 commit 8cdd137

File tree

1 file changed

+42
-28
lines changed

1 file changed

+42
-28
lines changed

source

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68414,32 +68414,10 @@ interface <dfn interface>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
6841468414
data-x="concept-settings-object-module-map">module map</span>.</p></li>
6841568415
<li><p>Let <var>moduleScript</var> be
6841668416
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)].</p></li>
68417-
<li><p>If <var>moduleScript</var> is null:</p>
68418-
<ul>
68419-
<li><p>Set <var>moduleScript</var> to the result of <span
68420-
data-x="creating a CSS module script">create a CSS module script</span> with an empty
68421-
<var>source</var> and <var>settingsObject</var>.</p></li>
68422-
<li><p>Set <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] to
68423-
<var>moduleScript</var>.</p></li>
68424-
<li><p><span>Fetch a single module script</span> given <var>url</var>,
68425-
<var>settingsObject</var>, "<code data-x="">style</code>", the
68426-
<span>default script fetch options</span>, <var>settingsObject</var>, "<code
68427-
data-x="">client</code>", true, and with the following steps given <var>result</var>:</p>
68428-
<ul>
68429-
<li><p>If <var>result</var> is null, then abort these steps.</p></li>
68430-
<li><p>Let <var>fetchedSheet</var> be the <code>CSSStyleSheet</code> extracted from
68431-
<var>result</var>'s <span
68432-
data-x="concept-script-record">record</span>.</p></li>
68433-
<li><p>Let <var>existingSheet</var> be the <code>CSSStyleSheet</code> extracted from
68434-
<var>moduleScript</var>'s <span
68435-
data-x="concept-script-record">record</span>.</p></li>
68436-
<li><p>Call <span>replaceSync</span> on <var>existingSheet</var> given the
68437-
<span data-x="concept-CSSStyleSheet-CSS-text">CSS text</span> of
68438-
<var>fetchedSheet</var>.</p></li>
68439-
</ul>
68440-
</li>
68441-
</ul>
68442-
</li>
68417+
<li><p>If <var>moduleScript</var> is null, <span>fetch a single module script</span> given
68418+
<var>url</var>, <var>settingsObject</var>, "<code data-x="">style</code>", the
68419+
<span>default script fetch options</span>, <var>settingsObject</var>, "<code
68420+
data-x="">client</code>", true</p></li>
6844368421
<li><p>Extract the <code>CSSStyleSheet</code> from <var>moduleScript</var>'s
6844468422
<span data-x="concept-script-record">record</span> and append it to
6844568423
<var>adoptedStyleSheets</var>. If any error occurs, then <span>continue</span>.</p></li>
@@ -117574,6 +117552,16 @@ document.querySelector("button").addEventListener("click", bound);
117574117552
<li><p><span data-x="map set">Set</span> <var>moduleMap</var>[(<var>url</var>,
117575117553
<var>moduleType</var>)] to "<code data-x="">fetching</code>".</p></li>
117576117554

117555+
<li><p>If <var>destination</var> is "<code data-x="">style</code>", then:</p>
117556+
<ol>
117557+
<li><p>Let <var>emptyStyleScript</var> be the result of <span>creating a CSS module
117558+
script</span> with an empty <var>source</var> and <var>settingsObject</var></p></li>
117559+
<li><p><span data-x="map set">set</span> <var>moduleMap</var>[(<var>url</var>,
117560+
<var>moduleType</var>)] to <var>emptyStyleScript</var>, retaining the "<code
117561+
data-x="">fetching</code>" status.</p></li>
117562+
</ol>
117563+
</li>
117564+
117577117565
<li><p>Let <var>request</var> be a new <span data-x="concept-request">request</span> whose
117578117566
<span data-x="concept-request-url">URL</span> is <var>url</var>, <span
117579117567
data-x="concept-request-mode">mode</span> is "<code data-x="">cors</code>", <span
@@ -117666,8 +117654,8 @@ document.querySelector("button").addEventListener("click", bound);
117666117654

117667117655
<li><p>If the <span>MIME type essence</span> of <var>mimeType</var> is "<code>text/css</code>"
117668117656
and <var>moduleType</var> is "<code data-x="">css</code>", then set <var>moduleScript</var> to
117669-
the result of <span>creating a CSS module script</span> given <var>sourceText</var> and
117670-
<var>settingsObject</var>.</p></li>
117657+
the result of <span>updating a CSS module script</span> given <var>sourceText</var> and
117658+
<var>moduleMap</var>[(<var>url</var>,<var>moduleType</var>)].</p></li>
117671117659

117672117660
<li><p>If <var>mimeType</var> is a <span>JSON MIME type</span> and
117673117661
<var>moduleType</var> is "<code data-x="">json</code>", then set <var>moduleScript</var> to
@@ -117978,6 +117966,32 @@ document.querySelector("button").addEventListener("click", bound);
117978117966
</ol>
117979117967
</div>
117980117968

117969+
<div algorithm>
117970+
<p>To <dfn data-x="updating a CSS module script">update a CSS module script</dfn>, given a
117971+
string <var>source</var> and a <var>script</var> <span>module script</span> :</p>
117972+
117973+
<ol>
117974+
<li><p>Let <var>sheet</var> be the default export of <var>script</var></p></li>
117975+
117976+
<li>
117977+
<p>Run the steps to <span>synchronously replace the rules of a <code>CSSStyleSheet</code></span>
117978+
on <var>sheet</var> given <var>source</var>.</p>
117979+
117980+
<p>If this throws an exception, catch it, and set <var>script</var>'s <span
117981+
data-x="concept-script-parse-error">parse error</span> to that exception, and return
117982+
<var>script</var>.</p>
117983+
117984+
<p class="note">The steps to <span>synchronously replace the rules of a
117985+
<code>CSSStyleSheet</code></span> will throw if <var>source</var> contains any <code
117986+
data-x="">@import</code> rules. This is by-design for now because there is not yet an
117987+
agreement on how to handle these for CSS module scripts; therefore they are blocked altogether
117988+
until a consensus is reached.</p>
117989+
</li>
117990+
117991+
<li><p>Return <var>script</var>.</p></li>
117992+
</ol>
117993+
</div>
117994+
117981117995
<div algorithm>
117982117996
<p>To <dfn data-x="creating a JSON module script">create a JSON module script</dfn>, given a
117983117997
string <var>source</var> and an <span>environment settings object</span> <var>settings</var>:</p>

0 commit comments

Comments
 (0)