Skip to content

Commit

Permalink
Add <link rel=serviceworker>+associated attributes
Browse files Browse the repository at this point in the history
This change defines the <link rel=serviceworker> link type and its
associated “scope”, “workertype”, and “usecache” content attributes, as
well as adding the corresponding “scope”, “workerType”, and “useCache”
IDL attributes to the HTMLLinkElement interface definition.
  • Loading branch information
sideshowbarker authored and Alice Boxhall committed Jan 7, 2019
1 parent e2c3809 commit 8a53dfd
Showing 1 changed file with 85 additions and 5 deletions.
90 changes: 85 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3759,10 +3759,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="dfn-control" data-x-href="https://w3c.github.io/ServiceWorker/#dfn-control">control</dfn></li>
<li><dfn data-x="on-fetch-request-algorithm" data-x-href="https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm">handle fetch</dfn></li>
<li><dfn data-x="scope-match-algorithm" data-x-href="https://w3c.github.io/ServiceWorker/#scope-match-algorithm">match service worker registration</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-scope-url">scope url</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-script-url">script url</dfn></li>
<li><dfn data-x="dfn-service-worker" data-x-href="https://w3c.github.io/ServiceWorker/#dfn-service-worker">service worker</dfn></li>
<li><dfn data-x="serviceworkercontainer-service-worker-client" data-x-href="https://w3c.github.io/ServiceWorker/#serviceworkercontainer-service-worker-client">service worker client</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-service-worker-registration">service worker registration</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-type">service worker type</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-serviceworker-link">serviceworker link</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#serviceworker"><code>ServiceWorker</code></dfn> interface</li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#serviceworkercontainer"><code>ServiceWorkerContainer</code></dfn> interface</li>
<li><dfn data-x-href="https://w3c.github.io/ServiceWorker/#dfn-use-cache">use cache</dfn></li>
</ul>

</dd>
Expand Down Expand Up @@ -12250,6 +12256,9 @@ interface <dfn>HTMLBaseElement</dfn> : <span>HTMLElement</span> {
<dd><code data-x="attr-link-type">type</code></dd>
<dd><code data-x="attr-link-sizes">sizes</code></dd>
<dd><code data-x="attr-link-referrerpolicy">referrerpolicy</code></dd>
<dd><code data-x="attr-link-scope">scope</code></dd>
<dd><code data-x="attr-link-usecache">usecache</code></dd>
<dd><code data-x="attr-link-workertype">workertype</code></dd>
<dd>Also, the <code data-x="attr-link-title">title</code> attribute <span data-x="attr-link-title">has special semantics</span> on this element.</dd>
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt><!--TOPIC:DOM APIs-->
<dd>
Expand All @@ -12267,6 +12276,9 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-link-type">type</span>;
[<span>CEReactions</span>, SameObject, PutForwards=<span data-x="dom-DOMTokenList-value">value</span>] readonly attribute <span>DOMTokenList</span> <span data-x="dom-link-sizes">sizes</span>;
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-link-referrerPolicy">referrerPolicy</span>;
[<span>CEReactions</span>] attribute USVString <span data-x="dom-link-scope">scope</span>;
[<span>CEReactions</span>] attribute <span>WorkerType</span> <span data-x="dom-link-workertype">workerType</span>;
[<span>CEReactions</span>] attribute boolean <span data-x="dom-link-useCache">useCache</span>;
};
<span>HTMLLinkElement</span> implements <span>LinkStyle</span>;</pre>
</dd>
Expand Down Expand Up @@ -12297,14 +12309,15 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<code data-x="rel-alternate">alternate</code>,
<code data-x="rel-dns-prefetch">dns-prefetch</code>,
<code data-x="rel-icon">icon</code>,
<code data-x="rel-next">next</code>,
<code data-x="rel-pingback">pingback</code>,
<code data-x="rel-preconnect">preconnect</code>,
<code data-x="rel-prefetch">prefetch</code>,
<code data-x="rel-preload">preload</code>,
<code data-x="rel-prerender">prerender</code>,
<code data-x="rel-search">search</code>,
<code data-x="rel-stylesheet">stylesheet</code>, and
<code data-x="rel-next">next</code>.
<code data-x="rel-serviceworker">serviceworker</code>, and
<code data-x="rel-stylesheet">stylesheet</code>.
<code data-x="attr-link-rel">rel</code>'s <span data-x="concept-supported-tokens">supported
tokens</span> must only include the tokens from this list that the user agent implements the
processing model for.</p>
Expand Down Expand Up @@ -12624,7 +12637,30 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {

<p class="note">The <code data-x="">apple-touch-icon</code> keyword is a registered <span
data-x="concept-rel-extensions">extension to the predefined set of link types</span>, but user
agents are not required to support it in any way.</p>.
agents are not required to support it in any way.</p>

<p>The <dfn><code data-x="attr-link-scope">scope</code></dfn> attribute specifies the <span>scope
url</span> for a <span>service worker registration</span>. If the attribute is present, the value
must be a <span>valid URL potentially surrounded by spaces</span>. The attribute must not be
specified on <code>link</code> elements that do not have a <code data-x="attr-link-rel">rel</code>
attribute that contains the <code data-x="rel-serviceworker">serviceworker</code> keyword.</p>

<p>The <dfn><code data-x="attr-link-workertype">workertype</code></dfn> attribute is an
<span>enumerated attribute</span> that specifies the <span>service worker type</span> for a
<span>service worker registration</span>. The attribute's keywords are <code
data-x="">classic</code> and <code data-x="">module</code>, which map to the respective states
<i>classic</i> and <i>module</i>. The <span>missing value default</span> is the <i>classic</i>
state. The attribute must not be specified on <code>link</code> elements that do not have a <code
data-x="attr-link-rel">rel</code> attribute that contains the <code
data-x="rel-serviceworker">serviceworker</code> keyword.</p>

<p>The <dfn><code data-x="attr-link-usecache">usecache</code></dfn> attribute is a <span>boolean
attribute</span> which sets <span>use cache</span> to true for a <span>service worker
registration</span>. The attribute must not be specified on <code>link</code> elements that do not
have a <code data-x="attr-link-rel">rel</code> attribute that contains the <code
data-x="rel-serviceworker">serviceworker</code> keyword.</p>

<hr>

<div w-nodev>

Expand Down Expand Up @@ -12655,8 +12691,9 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dfn><code data-x="dom-link-media">media</code></dfn>, <dfn><code
data-x="dom-link-hreflang">hreflang</code></dfn>, <dfn><code
data-x="dom-link-type">type</code></dfn>, <dfn><code data-x="dom-link-nonce">nonce</code></dfn>,
<dfn><code data-x="dom-link-integrity">integrity</code></dfn> and <dfn><code
data-x="dom-link-sizes">sizes</code></dfn> each must <span>reflect</span> the respective content
<dfn><code data-x="dom-link-integrity">integrity</code></dfn>, <dfn><code
data-x="dom-link-sizes">sizes</code></dfn>, and <dfn><code
data-x="dom-link-scope">scope</code></dfn> each must <span>reflect</span> the respective content
attributes of the same name.</p>

<p>The <dfn><code data-x="dom-link-crossOrigin">crossOrigin</code></dfn> IDL attribute must
Expand All @@ -12670,6 +12707,13 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<span>reflect</span> the <code data-x="attr-link-referrerpolicy">referrerpolicy</code>
content attribute, <span>limited to only known values</span>.</p>

<p>The <dfn><code data-x="dom-link-workerType">workerType</code></dfn> IDL attribute must
<span>reflect</span> the <code data-x="attr-link-workertype">workertype</code> content
attribute.</p>

<p>The <dfn><code data-x="dom-link-useCache">useCache</code></dfn> IDL attribute must
<span>reflect</span> the <code data-x="attr-link-usecache">usecache</code> content attribute.</p>

<p>Other specifications may add <a href="#linkTypes">HTML link types</a> as defined in <a
href="#other-link-types">Other link types</a>, with the following additional requirements:</p>

Expand Down Expand Up @@ -22704,6 +22748,14 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
<td>Gives a link to a resource that can be used to search through the current document and its related pages.</td>
</tr>

<tr>
<td><code data-x="rel-serviceworker">serviceworker</code></td>
<td><span>Hyperlink</span></td>
<td><em>not allowed</em></td>
<td class="no"> &middot; </td>
<td>Declares a <span>service worker registration</span>.</td>
</tr>

<tr>
<td><code data-x="rel-stylesheet">stylesheet</code></td> <!-- most commonly used <link rel> value, variants came in 7th, 8th, 12th, 17th... -->
<td><span data-x="external resource link">External Resource</span></td>
Expand Down Expand Up @@ -23327,6 +23379,19 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
the <code data-x="rel-search">search</code> link type to enable user agents to autodiscover search
interfaces. <ref spec=OPENSEARCH></p>

<h5>Link type "<dfn><code data-x="rel-serviceworker">serviceworker</code></dfn>"</h5>

<p>The <code data-x="rel-serviceworker">serviceworker</code> keyword may be used with
<code>link</code> elements. This keyword creates an <span data-x="external resource link">external
resource link</span> that is used to declare a <span>service worker registration</span> and its
<span>script url</span>, <span>scope url</span>, <span data-x="service worker type">type</span>,
and <span>use cache</span> setting.</p>

<p><span w-nodev>User agents must implement the processing model for <code>link</code>-element
<span data-x="serviceworker link">serviceworker links</span> described in <cite>Service
Workers</cite>, using the <code data-x="attr-link-href">href</code>, <code
data-x="attr-link-scope">scope</code>, <code data-x="attr-link-workertype">workertype</code>, and
<code data-x="attr-link-usecache">usecache</code> attributes.</span> <ref spec="SW"></p>

<!--ADD-TOPIC:CSS-->
<h5>Link type "<dfn><code data-x="rel-stylesheet">stylesheet</code></dfn>"</h5>
Expand Down Expand Up @@ -116998,6 +117063,11 @@ interface <dfn>External</dfn> {
"<code data-x="attr-th-scope-col">col</code>";
"<code data-x="attr-th-scope-rowgroup">rowgroup</code>";
"<code data-x="attr-th-scope-colgroup">colgroup</code>"
<tr>
<th> <code data-x="">scope</code>
<td> <code data-x="attr-link-scope">link</code>
<td> A <span>scope url</span> <span>service worker registration</span> (for <code data-x="attr-link-rel">rel</code>="<code data-x="rel-serviceworker">serviceworker</code>")
<td><span>Valid URL potentially surrounded by spaces</span>
<tr>
<th> <code data-x="">selected</code>
<td> <code data-x="attr-option-selected">option</code>
Expand Down Expand Up @@ -117199,6 +117269,11 @@ interface <dfn>External</dfn> {
<td> <code data-x="attr-object-typemustmatch">object</code>
<td> Whether the <code data-x="attr-object-type">type</code> attribute and the <span>Content-Type</span> value need to match for the resource to be used
<td> <span>Boolean attribute</span>
<tr>
<th> <code data-x="">usecache</code>
<td> <code data-x="attr-link-usecache">link</code>
<td> Whether to set <span>use cache</span> to true for a <span>service worker registration</span> (for <code data-x="attr-link-rel">rel</code>="<code data-x="rel-serviceworker">serviceworker</code>")
<td> <span>Boolean attribute</span>
<tr>
<th> <code data-x="">usemap</code>
<td> <code data-x="attr-hyperlink-usemap">img</code>;
Expand Down Expand Up @@ -117248,6 +117323,11 @@ interface <dfn>External</dfn> {
<code data-x="attr-dim-width">video</code>
<td> Horizontal dimension
<td> <span>Valid non-negative integer</span>
<tr>
<th> <code data-x="">workertype</code>
<td> <code data-x="attr-link-workertype">link</code>
<td> A <span>service worker type</span> for a <span>service worker registration</span> (for <code data-x="attr-link-rel">rel</code>="<code data-x="rel-serviceworker">serviceworker</code>")
<td> "<code data-x="">classic</code>"; "<code data-x="">module</code>"
<tr>
<th> <code data-x="">wrap</code>
<td> <code data-x="attr-textarea-wrap">textarea</code>
Expand Down

0 comments on commit 8a53dfd

Please sign in to comment.