Skip to content

Commit e4974a6

Browse files
committed
Escape trailing spaces in opaque paths
1 parent d2ca75f commit e4974a6

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

url.bs

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,6 +2846,14 @@ and then runs these steps:
28462846
<dt><dfn export for="basic URL parser" id=cannot-be-a-base-url-path-state>opaque path state</dfn>
28472847
<dd>
28482848
<ol>
2849+
<li><p>If <a>c</a> is U+003F (?) or U+0023 (#):
2850+
<ol>
2851+
<li><p>Let <var>n</var> be the number of U+0020 SPACE code points at the end of <var>url</var>'s
2852+
<a for=url>path</a>.
2853+
<li><p>Replace the last <var>n</var> code points in <var>url</var>'s <a for=url>path</a>
2854+
with <var>n</var> repetitions of the string "%20".
2855+
</ol>
2856+
28492857
<li><p>If <a>c</a> is U+003F (?), then set <var>url</var>'s <a for=url>query</a> to the empty
28502858
string and <var>state</var> to <a>query state</a>.
28512859

@@ -3352,21 +3360,6 @@ interface URL {
33523360
object.
33533361
</ul>
33543362

3355-
<p>To <dfn>potentially strip trailing spaces from an opaque path</dfn> given a {{URL}} object
3356-
<var>url</var>:
3357-
3358-
<ol>
3359-
<li><p>If <var>url</var>'s <a for=URL>URL</a> does not have an <a for=url>opaque path</a>, then
3360-
return.
3361-
3362-
<li><p>If <var>url</var>'s <a for=URL>URL</a>'s <a for=url>fragment</a> is non-null, then return.
3363-
3364-
<li><p>If <var>url</var>'s <a for=URL>URL</a>'s <a for=url>query</a> is non-null, then return.
3365-
3366-
<li><p>Remove all trailing U+0020 SPACE <a for=/>code points</a> from <var>url</var>'s
3367-
<a for=URL>URL</a>'s <a for=url>path</a>.
3368-
</ol>
3369-
33703363
<p>The <dfn>API URL parser</dfn> takes a <a>scalar value string</a> <var>url</var> and an optional
33713364
null-or-<a>scalar value string</a> <var>base</var> (default null), and then runs these steps:
33723365

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

3636-
<li><p><a>Potentially strip trailing spaces from an opaque path</a> with <a>this</a>.
3637-
36383629
<li><p>Return.
36393630
</ol>
36403631

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

3653-
<p class=note>The {{URL/search}} setter has the potential to remove trailing U+0020 SPACE
3654-
<a for=/>code points</a> from <a>this</a>'s <a for=URL>URL</a>'s <a for=url>path</a>. It does this
3655-
so that running the <a>URL parser</a> on the output of running the <a>URL serializer</a> on
3656-
<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>.
3657-
36583644
<p>The <dfn attribute for=URL><code>searchParams</code></dfn> getter steps are to return
36593645
<a>this</a>'s <a for=URL>query object</a>.
36603646

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

3679-
<li><p><a>Potentially strip trailing spaces from an opaque path</a> with <a>this</a>.
3680-
36813665
<li><p>Return.
36823666
</ol>
36833667

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

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

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

@@ -3813,10 +3794,6 @@ object <var>query</var>:
38133794

38143795
<li><p>Set <var>query</var>'s <a for=URLSearchParams>URL object</a>'s <a for=URL>URL</a>'s
38153796
<a for=url>query</a> to <var>serializedQuery</var>.
3816-
3817-
<li><p>If <var>serializedQuery</var> is null, then
3818-
<a>potentially strip trailing spaces from an opaque path</a> with <var>query</var>'s
3819-
<a for=URLSearchParams>URL object</a>.
38203797
</ol>
38213798
</div>
38223799

0 commit comments

Comments
 (0)