Skip to content

Commit 544d3fb

Browse files
Improve processing of <link> elements.
1 parent 90b690a commit 544d3fb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spec/service_worker/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,15 +1676,23 @@ <h1>Processing</h1>
16761676
</ol>
16771677
</spec-algorithm>
16781678

1679-
<p>When a <a href="#dfn-serviceworker-link">serviceworker link</a>'s <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element is inserted into a document, the user agent <em class="rfc2119" title="SHOULD">should</em> run these steps or their <a href="#dfn-processing-equivalence">equivalent</a>:</p>
1679+
<p>When a <a href="#dfn-serviceworker-link">serviceworker link</a>'s <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element is <a href="https://www.w3.org/TR/html5/infrastructure.html#in-a-document">inserted into a document</a>, a <a href="#dfn-serviceworker-link">serviceworker link</a> is created on a <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element that is already <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-a-document">in a Document</a>, or the <a href="https://html.spec.whatwg.org/multipage/semantics.html#attr-link-href">href</a> or <a href="#link-scope-attribute">scope</a> attributes of the <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element of a <a href="#dfn-serviceworker-link">serviceworker link</a> is changed, the user agent <em class="rfc2119" title="SHOULD">should</em> run these steps or their <a href="#dfn-processing-equivalence">equivalent</a>:</p>
16801680

16811681
<spec-algorithm>
16821682
<ol>
16831683
<li>If the <a href="https://html.spec.whatwg.org/multipage/semantics.html#attr-link-href">href</a> attribute is the empty string, abort these steps.</li>
16841684
<li>Let <var>client</var> be the document's <a href="#dfn-service-worker-container-interface-client">service worker client</a>.</li>
16851685
<li>Let <var>scriptURL</var> be the result of <a href="https://url.spec.whatwg.org/#concept-url-parser">parsing</a> the <a href="https://html.spec.whatwg.org/multipage/semantics.html#attr-link-href">href</a> attribute with document's <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#document-base-url">document base URL</a>.</li>
16861686
<li>Let <var>scopeURL</var> be the <a href="link-scope-attribute">scope</a> attribute, or null if the <a href="link-scope-attribute">scope</a> attribute is omitted.</li>
1687-
<li>Invoke <a href="#start-register-algorithm">Start Register</a> with <var>scopeURL</var>, <var>scriptURL</var>, a new <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promise</a>, <var>client</var>, and <var>client</var>'s <a href="https://html.spec.whatwg.org/multipage/browsers.html#origin-2">origin</a>.</li>
1687+
<li>Let <var>promise</var> be a new <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects">promise</a>.</li>
1688+
<li>Invoke <a href="#start-register-algorithm">Start Register</a> with <var>scopeURL</var>, <var>scriptURL</var>, <var>promise</var>, <var>client</var>, and <var>client</var>'s <a href="https://html.spec.whatwg.org/multipage/browsers.html#origin-2">origin</a>.</li>
1689+
<li>Run the following substeps <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>:
1690+
<ol>
1691+
<li>Wait until <var>promise</var> settles.</li>
1692+
<li>If <var>promise</var> rejected, <a href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a href="https://html.spec.whatwg.org/#fire-a-simple-event">fire a simple event</a> named <code>error</code> at the <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element.</li>
1693+
<li>If <var>promise</var> resolved, <a href="https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task">queue a task</a> to <a href="https://html.spec.whatwg.org/#fire-a-simple-event">fire a simple event</a> named <code>load</code> at the <a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a> element.</li>
1694+
</ol>
1695+
</li>
16881696
</ol>
16891697
</spec-algorithm>
16901698

0 commit comments

Comments
 (0)