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

Escape trailing spaces in opaque paths #785

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
39 changes: 8 additions & 31 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2846,6 +2846,14 @@ and then runs these steps:
<dt><dfn export for="basic URL parser" id=cannot-be-a-base-url-path-state>opaque path state</dfn>
<dd>
<ol>
<li><p>If <a>c</a> is U+003F (?), U+0023 (#), or the <a>EOF code point</a>:
<ol>
<li><p>Let <var>n</var> be the number of U+0020 SPACE code points at the end of <var>url</var>'s
<a for=url>path</a>.
<li><p>Replace the last <var>n</var> code points in <var>url</var>'s <a for=url>path</a>
with <var>n</var> repetitions of the string "%20".
</ol>

<li><p>If <a>c</a> is U+003F (?), then set <var>url</var>'s <a for=url>query</a> to the empty
string and <var>state</var> to <a>query state</a>.

Expand Down Expand Up @@ -3352,21 +3360,6 @@ interface URL {
object.
</ul>

<p>To <dfn>potentially strip trailing spaces from an opaque path</dfn> given a {{URL}} object
<var>url</var>:

<ol>
<li><p>If <var>url</var>'s <a for=URL>URL</a> does not have an <a for=url>opaque path</a>, then
return.

<li><p>If <var>url</var>'s <a for=URL>URL</a>'s <a for=url>fragment</a> is non-null, then return.

<li><p>If <var>url</var>'s <a for=URL>URL</a>'s <a for=url>query</a> is non-null, then return.

<li><p>Remove all trailing U+0020 SPACE <a for=/>code points</a> from <var>url</var>'s
<a for=URL>URL</a>'s <a for=url>path</a>.
</ol>

<p>The <dfn>API URL parser</dfn> takes a <a>scalar value string</a> <var>url</var> and an optional
null-or-<a>scalar value string</a> <var>base</var> (default null), and then runs these steps:

Expand Down Expand Up @@ -3633,8 +3626,6 @@ one might have assumed the setter to always "reset" both.
<li><p><a for=list>Empty</a> <a>this</a>'s <a for=URL>query object</a>'s
<a for=URLSearchParams>list</a>.

<li><p><a>Potentially strip trailing spaces from an opaque path</a> with <a>this</a>.

<li><p>Return.
</ol>

Expand All @@ -3650,11 +3641,6 @@ one might have assumed the setter to always "reset" both.
result of <a lt="urlencoded string parser">parsing</a> <var>input</var>.
</ol>

<p class=note>The {{URL/search}} setter has the potential to remove trailing U+0020 SPACE
<a for=/>code points</a> from <a>this</a>'s <a for=URL>URL</a>'s <a for=url>path</a>. It does this
so that running the <a>URL parser</a> on the output of running the <a>URL serializer</a> on
<a>this</a>'s <a for=URL>URL</a> does not yield a <a for=/>URL</a> that is not <a for=url>equal</a>.

<p>The <dfn attribute for=URL><code>searchParams</code></dfn> getter steps are to return
<a>this</a>'s <a for=URL>query object</a>.

Expand All @@ -3676,8 +3662,6 @@ so that running the <a>URL parser</a> on the output of running the <a>URL serial
<ol>
<li><p>Set <a>this</a>'s <a for=URL>URL</a>'s <a for=url>fragment</a> to null.

<li><p><a>Potentially strip trailing spaces from an opaque path</a> with <a>this</a>.

<li><p>Return.
</ol>

Expand All @@ -3690,9 +3674,6 @@ so that running the <a>URL parser</a> on the output of running the <a>URL serial
<a for="basic URL parser"><i>state override</i></a>.
</ol>

<p class=note>The {{URL/hash}} setter has the potential to change <a>this</a>'s <a for=URL>URL</a>'s
<a for=url>path</a> in a manner equivalent to the {{URL/search}} setter.


<h3 id=interface-urlsearchparams>URLSearchParams class</h3>

Expand Down Expand Up @@ -3813,10 +3794,6 @@ object <var>query</var>:

<li><p>Set <var>query</var>'s <a for=URLSearchParams>URL object</a>'s <a for=URL>URL</a>'s
<a for=url>query</a> to <var>serializedQuery</var>.

<li><p>If <var>serializedQuery</var> is null, then
<a>potentially strip trailing spaces from an opaque path</a> with <var>query</var>'s
<a for=URLSearchParams>URL object</a>.
</ol>
</div>

Expand Down