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

Specify URL encoding for links (header+element) #9764

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 4 commits
Commits
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
62 changes: 19 additions & 43 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -7086,8 +7086,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ol>

<p id="resolve-a-url">To <dfn export data-x="encoding-parsing a URL">encoding-parse a URL</dfn>,
given a string <var>url</var>, relative to a <code>Document</code> object or <span>environment
settings object</span> <var>environment</var>, run these steps. They return failure or a
given a string <var>url</var>, relative to a <code>Document</code> object or
<span>environment</span> <var>environment</var>, run these steps. They return failure or a
<span>URL</span>.</p>

<ol>
Expand All @@ -7097,15 +7097,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
to <var>environment</var>'s <span data-x="document's character encoding">character
encoding</span>.</p></li>

<li><p>Otherwise, if <var>environment</var>'s <span>relevant global object</span> is a
<code>Window</code> object, set <var>encoding</var> to <var>environment</var>'s <span>relevant
global object</span>'s <span data-x="concept-document-window">associated
<code>Document</code></span>'s <span data-x="document's character encoding">character
encoding</span>.</p></li>
<li><p>Otherwise, if <var>environment</var> is an <span>environment settings object</span> and
<var>environment</var>'s <span>relevant global object</span> is a <code>Window</code> object, set
<var>encoding</var> to <var>environment</var>'s <span>relevant global object</span>'s <span
data-x="concept-document-window">associated <code>Document</code></span>'s <span
data-x="document's character encoding">character encoding</span>.</p></li>

<li><p>Let <var>baseURL</var> be <var>environment</var>'s <span data-x="document base URL">base
URL</span>, if <var>environment</var> is a <code>Document</code> object; otherwise
<var>environment</var>'s <span>API base URL</span>.</p></li>
<var>environment</var>'s <span>API base URL</span>, if <var>environment</var> is an
<span>environment settings object</span>; otherwise <var>environment</var>'s <span
data-x="concept-environment-creation-url">creation URL</span>.</p></li>
domenic marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Return the result of applying the <span>URL parser</span> to <var>url</var>, with
<var>baseURL</var> and <var>encoding</var>.</p></li>
Expand Down Expand Up @@ -15547,14 +15549,10 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<li><p>If <var>options</var>'s <span data-x="link options destination">destination</span> is not
a <span data-x="concept-request-destination">destination</span>, then return null.</p></li>

<li>
<p>Let <var>url</var> be the result of <span>encoding-parsing a URL</span> given
<var>options</var>'s <span data-x="link options href">href</span>, relative to
<var>options</var>'s <span data-x="link options base url">base URL</span>.</p>
domenic marked this conversation as resolved.
Show resolved Hide resolved

<p class="XXX">Passing the base URL instead of a document or environment is tracked by <a
href="https://github.com/whatwg/html/issues/9715">issue #9715</a>.</p>
</li>
<li><p>Let <var>url</var> be the result of <span
data-x="encoding-parsing a URL">encoding-parse a URL</span> given
<var>options</var>'s <span data-x="link options href">href</span>, relative to
annevk marked this conversation as resolved.
Show resolved Hide resolved
domenic marked this conversation as resolved.
Show resolved Hide resolved
<var>options</var>'s <span data-x="link options environment">environment</span>.</p></li>

<li><p>If <var>url</var> is failure, then return null.</p></li>

domenic marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -15645,9 +15643,6 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dt><dfn data-x="link options source set">source set</dfn> (default null)</dt>
<dd>Null or a <span>source set</span></dd>

<dt><dfn data-x="link options base URL">base URL</dfn></dt>
<dd>A <span>URL</span></dd>

<dt><dfn data-x="link options origin">origin</dfn></dt>
<dd>An <span>origin</span></dd>

Expand All @@ -15668,11 +15663,6 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dd>A <span>fetch priority attribute</span> state</dd>
</dl>

<p class="note">A <span>link processing options</span> has a <span
data-x="link options base URL">base URL</span> and an <span data-x="link options href">href</span>
rather than a parsed URL because the URL could be a result of the options's <span
data-x="link options source set">source set</span>.</p>

<p>To <dfn>create link options from element</dfn> given a <code>link</code> element
<var>el</var>:</p>

Expand All @@ -15698,9 +15688,6 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dt><span data-x="link options source set">source set</span></dt>
<dd><var>el</var>'s <span>source set</span></dd>

<dt><span data-x="link options base URL">base URL</span></dt>
<dd><var>document</var>'s <span>document base URL</span></dd>

<dt><span data-x="link options origin">origin</span></dt>
<dd><var>document</var>'s <span data-x="concept-document-origin">origin</span></dd>

Expand Down Expand Up @@ -15817,9 +15804,6 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<dt><span data-x="link options href">href</span></dt>
<dd><var>linkObject</var>["<code data-x="">target_uri</code>"]</dd>

<dt><span data-x="link options base URL">base URL</span></dt>
<dd><var>doc</var>'s <span>document base URL</span></dd>

<dt><span data-x="link options origin">origin</span></dt>
<dd><var>doc</var>'s <span data-x="concept-document-origin">origin</span></dd>

Expand Down Expand Up @@ -16011,9 +15995,6 @@ data-x="rel-preload">preload</span>; <span data-x="attr-link-as">as</span>=font<
<dt><span data-x="link options initiator">initiator</span></dt>
<dd>"<code data-x="">early-hint</code>"</dd>

<dt><span data-x="link options base URL">base URL</span></dt>
<dd><var>response</var>'s <span data-x="concept-response-url">URL</span></dd>

<dt><span data-x="link options origin">origin</span></dt>
<dd><var>response</var>'s <span data-x="concept-response-url">URL</span>'s <span
data-x="concept-url-origin">origin</span></dd>
Expand Down Expand Up @@ -26859,17 +26840,12 @@ document.body.appendChild(wbr);</code></pre>
<p>To <dfn>preconnect</dfn> given a <span>link processing options</span> <var>options</var>:</p>

<ol>
<li><p>If <var>options</var>'s
<span data-x="link options href">href</span> is an empty string, returns.</p></li>

<li>
<p>Let <var>url</var> be the result of <span>encoding-parsing a URL</span> given
<var>options</var>'s <span data-x="link options href">href</span>, relative to
<var>options</var>'s <span data-x="link options base URL">base URL</span>.</p>
<li><p>If <var>options</var>'s <span data-x="link options href">href</span> is an empty string,
then return.</p></li>

<p class="XXX">Passing the base URL instead of a document or environment is tracked by <a
href="https://github.com/whatwg/html/issues/9715">issue #9715</a>.</p>
</li>
<li><p>Let <var>url</var> be the result of <span>encoding-parsing a URL</span> given
<var>options</var>'s <span data-x="link options href">href</span>, relative to
<var>options</var>'s <span data-x="link options environment">environment</span>.</p></li>

domenic marked this conversation as resolved.
Show resolved Hide resolved
<li><p>If <var>url</var> is failure, then return.</p></li>

Expand Down