Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Priority Hints changes to the html spec #8470

Merged
merged 29 commits into from
Feb 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e431c1d
Add the Priority Hints changes to the html spec
pmeenan Nov 3, 2022
c85da3a
First round of fixes from feedback (still WIP)
pmeenan Nov 4, 2022
2a3d6a8
Merge branch 'whatwg:main' into priority-hints
pmeenan Dec 2, 2022
a92e253
Merge branch 'whatwg:main' into priority-hints
pmeenan Jan 4, 2023
8d0eece
Merge branch 'whatwg:main' into priority-hints
pmeenan Jan 11, 2023
885557a
Cleaned up dangling variables
pmeenan Jan 11, 2023
9b73bf4
Formatting cleanup
pmeenan Jan 11, 2023
124eba5
Plumb fetchPriority through navigation
pmeenan Jan 18, 2023
c65c2ec
Merge branch 'whatwg:main' into priority-hints
pmeenan Jan 18, 2023
f7c8c53
Rename "nested navigable" to "content navigable"
domenic Jan 19, 2023
3fae597
Document exactly what works with the Link header
domenic Jan 19, 2023
385e54f
Meta: export "serializable object"
dontcallmedom Jan 20, 2023
59d000c
Fix typo in session history traversal parallel queue example
domfarolino Jan 23, 2023
0ec01fe
Update permisssions policy creation
clelland Jan 23, 2023
ba9cb8a
Properly assign history policy container
domfarolino Jan 24, 2023
37b4a08
Meta: export form owner and submit button
jenseng Jan 25, 2023
c3a901a
Merge branch 'whatwg:main' into priority-hints
pmeenan Jan 25, 2023
93247ca
Merge branch 'whatwg:main' into priority-hints
pmeenan Jan 30, 2023
e33a3d5
Fixed missing options and use "destination"
pmeenan Jan 30, 2023
9466ccc
Updated descendant script fetch options to not inherit fetch priority
pmeenan Feb 1, 2023
f57829d
Merge branch 'whatwg:main' into priority-hints
pmeenan Feb 8, 2023
5639d68
Cleanup formatting and attribute default state
pmeenan Feb 9, 2023
fd8998b
Minor fixes
domenic Feb 15, 2023
133deee
Oops
domenic Feb 15, 2023
d5908d0
Fix the attribute index
domenic Feb 16, 2023
4c701e7
Remove iFrame support
pmeenan Feb 16, 2023
7679f30
Merge branch 'whatwg:main' into priority-hints
pmeenan Feb 16, 2023
c6890d7
Added fetchpriority to the link header parsing
pmeenan Feb 16, 2023
65c22f3
Final tweaks
domenic Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
First round of fixes from feedback (still WIP)
  • Loading branch information
pmeenan committed Nov 4, 2022
commit c85da3a5fedd556cff8ad7bbff71c476506761c3
58 changes: 32 additions & 26 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-potential-destination-translate" data-x-href="https://fetch.spec.whatwg.org/#concept-potential-destination-translate">translating</dfn> a <span data-x="concept-potential-destination">potential destination</span></li>
<li><dfn data-x="concept-script-like-destination" data-x-href="https://fetch.spec.whatwg.org/#request-destination-script-like">script-like</dfn> <span data-x="concept-request-destination">destinations</span></li>
<li><dfn data-x="concept-request-priority" data-x-href="https://fetch.spec.whatwg.org/#concept-request-priority">priority</dfn></li>
<li><dfn data-x="concept-request-internalpriority" data-x-href="https://fetch.spec.whatwg.org/#concept-request-internalpriority">internalpriority</dfn></li>
<li><dfn data-x="concept-request-internal-priority" data-x-href="https://fetch.spec.whatwg.org/#concept-request-internal-priority">internal priority</dfn></li>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
<li><dfn data-x="concept-request-origin" data-x-href="https://fetch.spec.whatwg.org/#concept-request-origin">origin</dfn></li>
<li><dfn data-x="concept-request-referrer" data-x-href="https://fetch.spec.whatwg.org/#concept-request-referrer">referrer</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#synchronous-flag">synchronous flag</dfn></li>
Expand Down Expand Up @@ -7541,11 +7541,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn>implicitly potentially render-blocking</dfn>, which will be defined at the individual
elements. By default, an element is not <span>implicitly potentially render-blocking</span>.</p>

<h4>FetchPriority attributes</h4>
<h4>Fetch Priority attributes</h4>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<p>A <dfn>fetchpriority attribute</dfn> is an <span>enumerated attribute</span>. The following
<p>A <dfn>fetch priority attribute</dfn> is an <span>enumerated attribute</span>. The following
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
table lists the keywords and states for the attribute — the keywords in the left column map to
the states in the cell in the second column on the same row as the keyword.
the states in the cell in the second column on the same row as the keyword.</p>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<table>
<thead>
Expand Down Expand Up @@ -14639,11 +14639,11 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
</div>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<p>The <dfn element-attr for="link" data-x="attr-link-fetchpriority"><code>fetchpriority</code>
</dfn>attribute is a <span>fetchpriority attribute</span> that is intended for use with
<span data-x="external resource link">external resource links</span>, where it helps set the
<span data-x="concept-request-priority">priority</span> used when
<span data-x="fetch and process the linked resource">fetching and processing the linked
resource</span></p>
</dfn>attribute is a <span>fetch priority attribute</span> that is intended for use with
<span data-x="external resource link">external resource links</span>, where it helps set the
<span data-x="concept-request-priority">priority</span> used when
<span data-x="fetch and process the linked resource">fetching and processing the linked
resource</span></p>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<div w-nodev>
<hr>
Expand All @@ -14656,11 +14656,14 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-rel">rel</code></dfn>,
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-sizes">sizes</code></dfn>,
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-type">type</code></dfn>,
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-blocking">blocking</code></dfn>,
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-disabled">disabled</code></dfn> and
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-fetchPriority">fetchPriority</code></dfn>
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-blocking">blocking</code></dfn>, and
<dfn attribute for="HTMLLinkElement"><code data-x="dom-link-disabled">disabled</code></dfn>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
each must <span>reflect</span> the respective content attributes of the same name.</p>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<p>The <dfn attribute for="HTMLLinkElement"><code data-x="dom-link-fetchPriority">fetchPriority</code></dfn>
IDL attribute must <span>reflect</span> the <code data-x="attr-link-fetchpriority">fetchpriority</code>
content attribute, <span>limited to only known values</span>.</p>

<p class="note">There is no reflecting IDL attribute for the <code
data-x="attr-link-color">color</code> attribute, but this might be added later.</p>

Expand Down Expand Up @@ -14979,7 +14982,7 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dd>Null or an algorithm accepting a <code>Document</code></dd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some type system errors here.

First, this definitely shouldn't be an attribute (i.e., an Attr).

When you extract the value from the attribute, you're going to end up with a state. (E.g., attr-fetchpriority-high-state.) This is kind of like a strongly-typed enum. This is important because the state infrastructure normalizes away differences in attribute values, e.g. fetchpriority=" hIGHh " still gets normalized to the high state.

OK, but Fetch expects a string, not a fetch priority attribute state. So we need a conversion somewhere.

Probably it's nicest to store the string in the link options struct, and convert when you create it. One way to do the conversion would be:

The [canonical keyword] corresponding to the state of el's fetchpriority content attribute.


<dt><dfn data-x="link options fetchpriority">fetchpriority</dfn> (default the empty string)</dt>
<dd>A <span>fetchpriority attribute</span></dd>
<dd>A <span>fetch priority attribute</span></dd>
</dl>

<p class="note">A <span>link processing options</span> has a <span
Expand Down Expand Up @@ -25017,7 +25020,7 @@ document.body.appendChild(wbr);</code></pre>
<td><span data-x="external resource link">External Resource</span></td>
<td colspan="2"><em>not allowed</em></td>
<td class="yes"> Yes </td>
<td>Specifies that the user agent must preemptively <span data-x="concept-fetch">fetch</span> and cache the target resource for current <span data-x="navigate">navigation</span> according to the <span data-x="concept-potential-destination">potential destination</span> given by the <code data-x="attr-link-as">as</code> attribute (and the <span data-x="concept-request-internalpriority">internalpriority</span> associated with the <span data-x="concept-potential-destination-translate">corresponding</span> <span data-x="concept-request-destination">destination</span>).</td>
<td>Specifies that the user agent must preemptively <span data-x="concept-fetch">fetch</span> and cache the target resource for current <span data-x="navigate">navigation</span> according to the <span data-x="concept-potential-destination">potential destination</span> given by the <code data-x="attr-link-as">as</code> attribute (and the <span data-x="concept-request-internal-priority">internal priority</span> associated with the <span data-x="concept-potential-destination-translate">corresponding</span> <span data-x="concept-request-destination">destination</span>).</td>
</tr>

<tr>
Expand Down Expand Up @@ -25737,7 +25740,7 @@ document.body.appendChild(wbr);</code></pre>
<li><p>Let <var>referrer policy</var> be the current state of <var>el</var>'s <code
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
data-x="attr-link-referrerpolicy">referrerpolicy</code> attribute.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable isn't used?


<li><p>Let <var>fetchpriority</var> be the current state of <var>el</var>'s <code
<li><p>Let <var>fetchPriority</var> be the current state of <var>el</var>'s <code
data-x="attr-link-fetchpriority">fetchpriority</code> attribute.</p></li>

<li><p>Let <var>options</var> be a <span>script fetch options</span> whose <span
Expand Down Expand Up @@ -26039,7 +26042,7 @@ document.body.appendChild(wbr);</code></pre>
preemptively <span data-x="concept-fetch">fetch</span> and cache the specified resource according
to the <span data-x="concept-potential-destination">potential destination</span> given by the
<code data-x="attr-link-as">as</code> attribute (and the <span
data-x="concept-request-internalpriority">internalpriority</span> associated with the <span
data-x="concept-request-internal-priority">internal priority</span> associated with the <span
data-x="concept-potential-destination-translate">corresponding</span> <span
data-x="concept-request-destination">destination</span>), as it is highly likely that the user
will require this resource for the current navigation. <ref spec=PRELOAD></p>
Expand Down Expand Up @@ -27782,9 +27785,9 @@ interface <dfn interface>HTMLImageElement</dfn> : <span>HTMLElement</span> {
data-x="attr-img-decoding-auto-state">auto</span> state.</p>

<p>The <dfn element-attr for="img" data-x="attr-img-fetchpriority"><code>fetchpriority</code></dfn>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
attribute is a <span>fetchpriority attribute</span>. Its purpose is to set the
attribute is a <span>fetch priority attribute</span>. Its purpose is to set the
<span data-x="concept-request-priority">priority</span> used when
<span data-x="concept-fetch">fetching</span> the image</p>
<span data-x="concept-fetch">fetching</span> the image.</p>

<p>The <dfn element-attr for="img" data-x="attr-img-loading"><code>loading</code></dfn> attribute is a <span>lazy
loading attribute</span>. Its purpose is to indicate the policy for loading images that are
Expand Down Expand Up @@ -31805,7 +31808,7 @@ interface <dfn interface>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
data-x="attr-iframe-referrerpolicy">referrerpolicy</code> content attribute.</p></li>
pmeenan marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Let <var>fetchPriority</var> be the current state of <var>element</var>'s <code
data-x="attr-iframe-fetchpriority">fetchpriority</code> content attribute.</p></li>
data-x="attr-iframe-fetchpriority">fetchpriority</code> content attribute.</p></li>

<li><p>Set <var>element</var>'s <span>current navigation was lazy loaded</span> boolean to
false.</p></li>
Expand Down Expand Up @@ -32277,7 +32280,7 @@ interface <dfn interface>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
</ol>

<p>The <dfn element-attr for="iframe" data-x="attr-iframe-fetchpriority">
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
<code>fetchpriority</code></dfn> attribute is a <span>fetchpriority attribute</span>. Its purpose
<code>fetchpriority</code></dfn> attribute is a <span>fetch priority attribute</span>. Its purpose
is to set the fetchpriority used when <span
data-x="process the iframe attributes">processing the <code>iframe</code> attributes</span>.</p>

Expand Down Expand Up @@ -59729,7 +59732,7 @@ interface <dfn interface>HTMLScriptElement</dfn> : <span>HTMLElement</span> {

<p>The <dfn element-attr for="script"><code
data-x="attr-script-fetchpriority">fetchpriority</code></dfn> attribute is a
<span>fetchpriority attribute</span>. Its purpose is to set the <span
<span>fetch priority attribute</span>. Its purpose is to set the <span
data-x="concept-request-priority">priority</span> used when <span
data-x="concept-fetch">fetching</span> the script.</p>

Expand All @@ -59749,12 +59752,15 @@ interface <dfn interface>HTMLScriptElement</dfn> : <span>HTMLElement</span> {
data-x="dom-script-src">src</code></dfn>, <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-type">type</code></dfn>, <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-defer">defer</code></dfn>, <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-integrity">integrity</code></dfn>, <dfn attribute
for="HTMLScriptElement"><code data-x="dom-script-blocking">blocking</code></dfn>, and <dfn
attribute for="HTMLScriptElement"><code
data-x="dom-script-fetchPriority">fetchPriority</code></dfn>, must each
data-x="dom-script-integrity">integrity</code></dfn>, and <dfn attribute
pmeenan marked this conversation as resolved.
Show resolved Hide resolved
for="HTMLScriptElement"><code data-x="dom-script-blocking">blocking</code></dfn>, must each
<span>reflect</span> the respective content attributes of the same name.</p>

<p>The <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-fetchPriority">fetchPriority</code></dfn>IDL attribute must
<span>reflect</span> the <code data-x="attr-script-fetchpriority">fetchpriority</code>
content attribute, <span>limited to only known values</span>.</p>

<p>The <dfn attribute for="HTMLScriptElement"><code
data-x="dom-script-referrerPolicy">referrerPolicy</code></dfn> IDL attribute must
<span>reflect</span> the <code data-x="attr-script-referrerpolicy">referrerpolicy</code> content
Expand Down Expand Up @@ -95810,7 +95816,7 @@ document.querySelector("button").addEventListener("click", bound);
<dt><dfn data-x="concept-script-fetch-options-fetch-priority">fetch priority</dfn></dt>

<dd><p>The <span data-x="concept-request-priority">priority</span> used for the
initial fetch</p></dd>
initial fetch</p></dd>

</dl>

Expand Down